The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> A way to have a single link deliver TWO href?
eabigelow
post Oct 13 2011, 03:06 PM
Post #1


Newbie
*

Group: Members
Posts: 13
Joined: 24-August 11
Member No.: 15,242



Hi--

I have a link that has an mp3 sound as its href:

CODE
<a href="sounds/genealogy.mp3" class="track track-default">this is a link</a>


Unfortunately, I also need that same link to go to a part on the site (href=#dombo) so that the sound plays on that part of the site.

Does anyone know how to accomplish this? I am imagining it would be with javascript, but honestly, I do not know.

Any help would be greatly appreciated. Many thanks...!

This post has been edited by eabigelow: Oct 13 2011, 03:07 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
eabigelow
post Oct 14 2011, 04:02 PM
Post #2


Newbie
*

Group: Members
Posts: 13
Joined: 24-August 11
Member No.: 15,242



Thanks so much for your replies and for giving this a try. I keep thinking there has to be a way--maybe a javascript function so that when you do an onclick it will make two things happen at once, or one after the other?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 14 2011, 04:44 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



That's what I tried, directing a hidden iframe to the mp3, but that made the page jump away from the anchor... But you could give it a try.
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 14 2011, 06:50 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Hey, if you add a time lapse between the loading of the mp3 in the iframe and the changing of the URL of the page to the anchor it could work.

Look at this and see what you think. Now I load a page in the iframe, but you could load the mp3 and make the iframe invisible. I don't know if I like it, but it seems to work. The BR tags are just to make the page long enough to scroll.

HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>

<script type="text/javascript">
<!--

function doDa()
{
document.getElementById('ifr').src = 'http://google.com';
setTimeout("window.location = '#here'",300);
}

//-->

</script>
</head>


<body>


<a href="#here" onclick="doDa(); return false">Click me</a>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<p id="here">HERE</p>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<iframe src="http://htmlhelp.com" name="ifr" id="ifr" width="200" height="200"></iframe>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

</body>
</html>
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 05:19 PM