PDA

View Full Version : I Need help! onmouseover, onmouseout



xziled
12-17-2005, 06:17 PM
Is it possible to have a image change and a sound play onmouseover/onmouseout simotaniously? I cant get it to work i must be doing something wrong?

I can only get on or the other to work...

Twey
12-17-2005, 06:19 PM
Of course. Seperate statements with a semicolon (;).

xziled
12-17-2005, 06:31 PM
ugh It's still not working.. BELOW is what i'm doing.


<script LANGUAGE="JavaScript"><!--
//

var aySound = new Array();
//
aySound[0] = "nav.wav";

//
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
//-->
</script>



<img border="0" src="sp8.jpg"><A HREF="contact.html"
onMouseOver="document.pic8.src='contact2.jpg'; "playSound(0)" onMouseOut="document.pic8.src='contact.jpg'; "stopSound(0)"><IMG SRC="contact.jpg" BORDER=0 NAME="pic8"></a>



any idea's????

Twey
12-17-2005, 06:45 PM
<img border="0" src="sp8.jpg"><A HREF="contact.html"
onMouseOver="document.pic8.src='contact2.jpg';playSound(0)" onMouseOut="document.pic8.src='contact.jpg';stopSound(0)"><IMG SRC="contact.jpg" BORDER=0 NAME="pic8"></a>

xziled
12-17-2005, 06:49 PM
oh man. I totally spaced that! Thanks!!!! :)