java script help

Sharky Forums


Results 1 to 7 of 7

Thread: java script help

  1. #1
    Tiger Shark
    Join Date
    Mar 2001
    Location
    Next door.
    Posts
    546

    Post java script help

    hi everyone,

    I need a preload script to preload sounds so that each time someone clicks on a picture, this sound will take the characteristic of the bgsound. I have the actual sound code written with the onCLick function, but i need these sounds to preload so there will be no time delay. thanks.

    ------------------
    "There are two steps to success: 1. Never tell everything you know 2. See #1"
    BLAH

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    This is a generic image preloader, but it should work for sounds just the same. Simply change what's between the quotes below to whatever sounds you want preloaded.

    <script language=javascript>
    <!--- //

    imgNames = new Array(
    "/sounds/yoursound.wav",
    "/sounds/yoursound2.wav"
    )

    loadImgs = new Array()

    for(i=0; i < imgNames.length; i++) {
    loadImgs[i] = new Image;
    loadImgs[i].src = imgNames[i];
    }

    // --->
    </script>

  3. #3
    Tiger Shark
    Join Date
    Mar 2001
    Location
    Next door.
    Posts
    546

    Thumbs up

    thank you!

    ------------------
    "There are two steps to success: 1. Never tell everything you know 2. See #1"
    BLAH

  4. #4
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    My pleasure! Lemme know if it works or not!

  5. #5
    Tiger Shark
    Join Date
    Mar 2001
    Location
    Next door.
    Posts
    546

    Post

    thank you, the preload script worked well in ie. however, i still can't get my sounds to play in netscape using an onClick="bgsound.src=''...i am not even sure if netscape supports bgsound??? thoughts? thanks.

    ------------------
    "There are two steps to success: 1. Never tell everything you know 2. See #1"
    BLAH

  6. #6
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Yeeeaaaah....Netscape's always been a little tricky with playing sounds. I'm sorry but it really is a bad browser. I really wouldn't know how to help you in that aspect...I've personally never found a way to get Netscape to play sounds on mouseEvents properly, outside of doing the whole thing in Flash of course. Best of luck to you buddy

  7. #7
    Tiger Shark
    Join Date
    Mar 2001
    Location
    Next door.
    Posts
    546

    Post

    aside from my planned international boycott on netscape (because it does not support vbscript, css, some javascript and html), and have a few ideas using the embed src tag and arrays to make an onClick play bgsound thing work. I will post it when I figure it out. Thanks for your help with the preload.

    ------------------
    "There are two steps to success: 1. Never tell everything you know 2. See #1"
    BLAH

Posting Permissions

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