Results 1 to 7 of 7

Thread: a cross browser sound function for IE and FX

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default a cross browser sound function for IE and FX

    hey I have a a nice little script for ya...

    I couldnt get sounds on buttons in both IE and FX

    I spent 4 hours reading and writing to make it work .. have little knowledge with coding...

    it consists of a java script that I found in a forum discussion on the subject..

    Put this between the <heads>

    </script>

    <script>
    function EvalSound(soundobj) {
    var thissound= document[soundobj];
    thissound.Play();
    }
    </script>



    first part is a embedded sound file, a little modified to work in firefox
    =======================================================
    this must be changed to the appropriate mediatype ---> type="audio/wav" for example type="application/asx" or other ....
    =======================================================

    ------------------body part--------------------------------------------
    <embed src="yuorsoundfile.wav" type="audio/wav" autostart="FALSE" loop="false"
    width="0" height="0" name="sound1" enablejavascript="true">



    then comes the button part :
    <a href="page.html" target="" onmouseover="EvalSound('sound1')">
    --------------------------------------------------------------------------

    you may add or replace the onmousover with onclick or other function and it can easily be adapted to other applications
    notice that the "Evalsound" sends also the id to which embedded file.. so u may have several embedded function working through the one javascript

    I havent tested it with netscape or opera ... but it works like a dream in IE and FX
    and in a menu u just use the same code over again.. and u control the audio though the embedded code...so u dont have to rewrite the entire menu to if u change sound or somethnig...

    Peace out...

  2. #2
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That will only work if the FF user has installed the Quicktime plugin installed and configured to play wav files.

    And here's a slightly simpler way:
    embed tag:
    <embed src="youraudiofile.wav" type="audio/wav" autostart="FALSE" loop="false"
    width="0" height="0" id="sound1" enablejavascript="true">

    trigger:
    onmouseover="document.getElementById('sound1').play();"

    No other script needed. Again, this will specifically only work for Quicktime.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Badly written; even the author tagged it as "old."
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The link? Still lots of useful info. Got a replacement link?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This has been discussed a few times on this very forum. Search.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    ...and I found that
    (Last time... stored it, just posted it this time.)

    but... yeah... I remember a couple conversations worth noting.

    check them out, madhatterz.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •