Results 1 to 7 of 7

Thread: Combine two javascripts

  1. #1
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Combine two javascripts

    Hello, I am an amateur webmaster and can't figure out how to combine two javascripts. I've looked all over the internet and have found a couple of sites where this is discussed, but I guess for me it is too complicated and need it at a JS Kindergarten level! What I want is for my piano menu to play sound on rollover and look like it is really playing. I can do the rollover effect OR the sound but I can't make both codes work at the same time. I found a site that discusses the problems of combining to JS scripts and how to fix but I don't understand it!!! .....Can any of you help??? Here are two possible scripts that would need to be combined: http://www.dynamicdrive.com/dynamicindex15/domroll.htm and http://www.dynamicdrive.com/dynamici...criptsound.htm

    This is my test site that I can't get sound to. http://www.delraybeachchorale.org/test.htm

    Maybe some nice person out there can help a damsel in distress???

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Oddly enough, you will be better off using the MM_swapImage()/MM_swapImgRestore() as you have it on your demo page and forgetting about the DD rollover script. To add the sound script, simply follow the installation instructions on its demo page, only add its call to the existing mouseover call from MM_swapImage(), ex:

    Code:
    onMouseOver="MM_swapImage('Image2','','key2down.jpg',1);playsound(soundfile);"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    THANK YOU!!!!! Look how cool! http://www.delraybeachchorale.org/test.htm
    I will update with real notes on the second octave soon! Your are awesome! I think that I'd been missing that final semi colon AFTER the sound.....did the one in between but not after. Thanks for your quick reply. Happy holidays!!!!

  4. #4
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I added

    ;playsound(tick.wav);

    to

    onMouseOver="MM_nbGroup('over','Bibles','BiblesS.jpg','Bibles.jpg',1)

    to get

    onMouseOver="MM_nbGroup('over','Bibles','BiblesS.jpg','Bibles.jpg',1);playsound(tick.wav);

    well... now its just saying that tick is undefined....

    I'm trying to do something similar to what Atrytonopsis is trying to do but its a menu...

    am I doing it wrong then?

    thanks

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Assuming all else is right with your code, tick.wav (being a literal) needs to be quoted (oh, and the event's function needs a closing quote):

    Code:
    onMouseOver="MM_nbGroup('over','Bibles','BiblesS.jpg','Bibles.jpg',1);playsound('tick.wav');"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    When I mouseover the <a href for this, I get a js error "Object Expected"
    Code:
    onMouseOver="playsound('tick.wav');MM_nbGroup('over','Bibles','BiblesS.jpg','Bibles.jpg',1);"

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's what I was talking about when I said:

    Quote Originally Posted by jscheuer1
    Assuming all else is right with your code
    To really tell, I'd need to see the page. Most likely, you do not have one of the functions mentioned in the event defined, or defined but with error(s). Most likely it is the 'playsound()' function and most likely it is missing from your page. The 'playsound()' function is, I believe, a DD script and (be it a DD script or any other script) for it to work, the code for it must be on or available to your page. But, that's just the most likely scenario:

    PLEASE: Include the URL to your problematic webpage that you want help with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •