Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Adding sound to a hyperlink

  1. #1
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adding sound to a hyperlink

    Hi can anyone help, how do you add or embed sound to a hyperlink.
    So if press the hyperlink and before the page load i want the sound to go on.
    Please let me know if anyone can help me.

    thank you

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Probably the best (or most successful) way would be to use Flash. Perhaps javascript could do it, but it might cause errors in certain browsers. As far as plain HTML goes, you will not be able to do it.

    Hope this helps.

  3. #3
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How would i do it JScripts.

    can you give an example showing me hyperlink with a sound clip please.

    thanks

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay, I fiddled around with this a bit and discovered that no matter which way you pull it, you can't change the "src" attribute for an embed. The only way I could see how to do it was like this:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Music Player</title>
    <script type="text/javascript">
    function play(file) {
    var plist = document.getElementById("playarea");
    plist.innerHTML = '<embed src="'+file+'">';
    }
    </script>
    </head>
    <body>
    <div id="playarea">
    	<embed src="mysong1.mp3">
    </div>
    <br><a href="javascript:play('mysong2.mp3')">play song</a>
    </body>
    </html>
    - Mike

  5. #5
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    What i wanted was

    the text is called log out. now if i click on that text it will take me to another page (href=http//:www.www.com). before that loads up i want the sound to go on. (.wav file).

    thats what im looking for.

    Please show me how to do that.

    thanks

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Simple answer... you can't. Even using a server side language, you are trying to make the browser do two things, in two different spots at once.

    For example, you are telling the browser to parse this sound on click, okay we can do that. You can also tell the browser to go to another page on click. Sure. But telling browser to go to page X, WHILE playing sound from page Y... nope.

    As stated, you can do it in a Flash movie, but without a ton of coding, know how and confusing jargon.. you can't.

    I wont tell you it's impossible, but I can tell you there isn't a ready made script that will do this (at least not one that will work proper.)
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    well, what you can do is create a page... sound.html for instance... and link your href to it, then embed a quick sound on that top play and add java to make it redirect in like 2 seconds... other than that you got me

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Demonicman View Post
    add java to make it redirect in like 2 seconds...
    You mean javascript.

  9. #9
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    and spell out the entire word? pfft yea right :P

  10. #10
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well considering they are 2 completely different languages, it makes a HUGE difference. Of course you could have just typed "JS" and saved another 2 letters...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •