Click to See Complete Forum and Search --> : playing link sounds using CSS


maddcrazyhatter
01-25-2006, 11:57 AM
Ive got mouse over and mouse click sounds playing using embeded sound objects and adding onclick="document.all.snd_object.play()" as a property of each <a> ref. But this is all way too cumbersome.

There has got to be a way to have all my body elements embed the sounds and all my <a> refs call the appropriate onclick, onmouseover, and onmouseout events using a style sheet.

What I want is to have this all setup via my css file so that my entire website plays mouse over and mouse click when the user clicks on links.

Is this possible?

Selrach
01-25-2006, 01:54 PM
you probably would need to use javascript with this.

something like:
function correctTags(){
var aTags = document.getTagsByName('a');
for(var i=0; i<aTags.length; i++){
aTags[i].onclick= "document.all.snd_object.play()";
aTags[i].onmouseover = "document.all.snd_objectMouseOver.play()";
aTags[i].onmouseout = "document.all.snd_objectMouseOut.play()";
}
}

Call this function in the onload event of the body

frencam
01-25-2006, 03:43 PM
I haven't tried it yet but have you looked into using the A:HOVER command from CSS? That might be something you could play around with and see if it works.