.wav-sound when clicking link (IE)

They have: 11 posts

Joined: Nov 1999

I'm converting a educational book to HTML, and the authors wants to make it a bit "funnier" to read, with sounds and crap like that...

So... when a user clicks an image that says "Next page >>", I want a wave (or midi) sound... like a beep or something. Is this possible? only info I find is how to get a damn midifile as backgroundmusic, and that is NOT what I want... I really hate webpages with sound

If someone could show an example of a javascript or something that gives me a bit of sound in IE5 (4), I'd really appreciate it!

./mdk

./mdk

AndyB's picture

They have: 344 posts

Joined: Aug 1999

here you go

<SCRIPT LANGUAGE=JavaScript>
<!-- Hide from old browsers
// Copyright © 1999 Doug Popeney
// Created by Doug Popeney ([email protected])
// JavaScript Made Easy!! - http://www.easyjavascript.com
function playSound(){
document.sound1.play();
}
// -->
</SCRIPT>

Now put this anywhere in your page.

<EMBED SRC="YOUR SOUND FILE" autostart=false HIDDEN=TRUE NAME="sound1" MASTERSOUND>
<A HREF="" onMouseOver="playSound()" onClick="return false;">
<IMG SRC="IMAGE FILE"></A>

If you want the link to work, the previous should look like this...

<EMBED SRC="YOUR SOUND FILE" autostart=false HIDDEN=TRUE NAME="sound1" MASTERSOUND>
<A HREF="YOUR LINK GOES HERE" onMouseOver="playSound()">
<IMG SRC="IMAGE FILE"></A>

They have: 231 posts

Joined: Feb 2000

Use Flash for cross-browser mouseover sounds. They are really easy to make. You can get a free fully functional demo at www.macromedia.com

They have: 11 posts

Joined: Nov 1999

Thanks Andy.. a small detail though, I had to change the document.sound1.play() line to document.sound1.run() ... .play is for Netrape(tm) I think

and since it's a mouseover thingy, it doesnt make sound when the user presses the link, just when ... well, I suppose you know how mouseover works
Doesnt seem to work with onClick="playSound()", so I think I'll make it onLoad in the body tag on the "next page" so to speak... or is it possible to get it to work with onClick ? Perhaps if I somehow made a delayed link, but I dont really want that much trouble...

note to Lloyd... I considered using flash first, but I dont intend to spend the rest of my life in this lousy place (ie. not more than a couple of months, I'm bored...) and they need to be able to update it themselves... and they wont be able to learn flash

./mdk

./mdk

AndyB's picture

They have: 344 posts

Joined: Aug 1999

If you visit the http://www.easyjavascript.com you'll find numerous variants of the mouseOver sounds etc. I chose what I thought was the closest to what you wanted ... btw it worked for me using IE5 (tested it before I posted).

They have: 67 posts

Joined: Aug 1999

Hi,
For a good mouseover sound script that you can use seperate sounds on different links, mouseover and onclick, and works fine in NS and IE you can go here. http://jsarchive.8m.com/newAudio.html
good luck.
Ian

------------------
Webmaster A1 JavaScripts
A1 JavaScripts
Webmaster The Manor
The Manor
Head Guide 123Webmaster.com
123Webmaster com

Webmaster A1 JavaScripts
A1 JavaScripts
Web Development - Big Resources Inc
BIG Resources.com

They have: 231 posts

Joined: Feb 2000

mdk: Flash is not really that hard to learn. There are some great tutorials that come with the demo and you can use these as templates. There are also many Flash forums on the net for support.

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

They have: 11 posts

Joined: Nov 1999

Andy: Ah, yes... but its not really a onMouseOver script I want, its a onClick script... theres a lot of links on the first page, and it would get noisy if it was just a onmouseover... Checked the site out, and all I could find was soundscript for netscape!? Perhaps Im blind, or just plain stupid, not sure which one...

Ian: Thanks, sounds like the script I was looking for... didnt quite want to work in my IE, but I'll check the code and see what I can do!

Lloyd: You dont know the people that works here... there's no point in even trying to get them to learn Flash;-)
I know I wouldn't have any problems to learn to use it, but like I said, I don't plan on staying here very much longer... looking for a new job, Im bored to death with this ****.
Anyone feels like offering me a job in Sweden?

./mdk

./mdk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.