CalifNina
06-02-2003, 08:24 PM
Hi, First time trying 'onMouseover.' I searched through this forum and found a previous thread on 'onMouseover' and 'onMouseout'; it suggested some code to use ... I took that and inserted my details, but is not working. I've spent about 2 hours changing and trying diff things -- can't get it to work. Need someone to review and see if they can determine what's wrong?
All original code is inserted below, my ONLY editing is in red text. NOTE: sound files are in the same directory but in a folder named "sounds2"
In HEAD section:
<SCRIPT LANGUAGE="JavaScript">
<!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "sounds2/soundA.wav";
aySound[1] = "sounds2/soundB.wav";
aySound[2] = "sounds2/soundC.wav";
aySound[3] = "sounds2/soundD.wav";
// DO NOT edit below this line
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>
In BODY section:
.
.
.
<img src="Point.gif"><a href="http://www.abcnews.com" onMouseover="playSound(0)"
onMouseout="stopSound(0)"><strong>"ABC"</strong></a>
<img src="Point.gif"><a href="http://www.cnn.com" onMouseover="playSound(1)"
onMouseout="stopSound(1)"><strong>CNN</strong></a>
<img src="Point.gif"><a href="javascript:playSound(2);" onMouseover="playSound(2)"
onMouseout="stopSound(2)"><strong>Sample 3</strong></a>
<img src="Point.gif"><a href="javascript:playSound(3);" onMouseover="playSound(3)"
onMouseout="stopSound(3)"><strong>Sample 4</strong></a>
I tried two methods to make it work- to get a total of four samples (two per method). I just do not get it. What is wrong -- my stuff?? the original code?? Pulling hair out and about to toss this laptop on the floor!! :mad: :confused: :mad: (NOTE: I did not insert those two faces in the code; rather there is a 'colon' and a 'P' that the 'stick out tongue' faces are in lue of.
Please plsssssss help. ~ Nina
All original code is inserted below, my ONLY editing is in red text. NOTE: sound files are in the same directory but in a folder named "sounds2"
In HEAD section:
<SCRIPT LANGUAGE="JavaScript">
<!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "sounds2/soundA.wav";
aySound[1] = "sounds2/soundB.wav";
aySound[2] = "sounds2/soundC.wav";
aySound[3] = "sounds2/soundD.wav";
// DO NOT edit below this line
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>
In BODY section:
.
.
.
<img src="Point.gif"><a href="http://www.abcnews.com" onMouseover="playSound(0)"
onMouseout="stopSound(0)"><strong>"ABC"</strong></a>
<img src="Point.gif"><a href="http://www.cnn.com" onMouseover="playSound(1)"
onMouseout="stopSound(1)"><strong>CNN</strong></a>
<img src="Point.gif"><a href="javascript:playSound(2);" onMouseover="playSound(2)"
onMouseout="stopSound(2)"><strong>Sample 3</strong></a>
<img src="Point.gif"><a href="javascript:playSound(3);" onMouseover="playSound(3)"
onMouseout="stopSound(3)"><strong>Sample 4</strong></a>
I tried two methods to make it work- to get a total of four samples (two per method). I just do not get it. What is wrong -- my stuff?? the original code?? Pulling hair out and about to toss this laptop on the floor!! :mad: :confused: :mad: (NOTE: I did not insert those two faces in the code; rather there is a 'colon' and a 'P' that the 'stick out tongue' faces are in lue of.
Please plsssssss help. ~ Nina