Durtdawber
06-07-2002, 03:34 PM
I am trying to add some mousover effects to image map hotspots. The code is shown below this message and can be run by saving to an html file.
I have followed the instructions with several java scripts that directed me to put the script in the header and then put a function call in the link. I have bolded the script and the function calls.
It does not work. I don't get a error indication. I wonder if the difference in the <area instead of <a.
Any idea?...Donnie
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Treasure Spot Hunt Field</title>
<SCRIPT language="javascript">
function createWindow(cUrl,cName,cFeatures) {
var xWin = window.open(cUrl,cName,cFeatures)
}
//MOUSEOVER SOUND
// 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] = "alarm.wav";
aySound[1] = "Ding.wav";
// DO NOT edit below this line
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>
</head>
<body bgcolor="#008080" link="#FFFFEE" vlink="#FFFFEE" alink="#FFFFEE">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#008080" width="100%">
<tr>
<td valign="middle" align="center"><a href="http://www.mytreasurespot.com/new"><img border="0" src="http://www.mytreasurespot.com/new/logos/tslogo.gif" width="458" height="118"></a><br>
</td>
</tr>
</table>
</div>
<center>
<br>
Scan the hunt field using your mounse cursor. When you find a target the cursor will<br>
change shape (usually change to a hand). Click on that area to reveal your find.<br>
Difficulty Setting = Very Hard-> <b><i>1</i></b> 2 3 4 5 6 7 8 9 10 <-Very Easy<br>
<b><i>This is a Test Hunt...No prizes are being given away...Practice and testing only!</i></b><br>
<img src="http://www.mytreasurespot.com/new/hunt/huntfield.jpg" border="0" usemap="#huntfield">
<map name="huntfield">
<area href="http://www.mytreasurespot.com/new/hunt/hunt03.html" onMouseOver="playSound(0)" onMouseOut="stopSound(0)" ALT="Target Found...Click To Dig!!!" shape="circle" coords="487,48,10">
</map>
<br>
</center>
</body>
</html>
I have followed the instructions with several java scripts that directed me to put the script in the header and then put a function call in the link. I have bolded the script and the function calls.
It does not work. I don't get a error indication. I wonder if the difference in the <area instead of <a.
Any idea?...Donnie
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Treasure Spot Hunt Field</title>
<SCRIPT language="javascript">
function createWindow(cUrl,cName,cFeatures) {
var xWin = window.open(cUrl,cName,cFeatures)
}
//MOUSEOVER SOUND
// 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] = "alarm.wav";
aySound[1] = "Ding.wav";
// DO NOT edit below this line
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>
</head>
<body bgcolor="#008080" link="#FFFFEE" vlink="#FFFFEE" alink="#FFFFEE">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#008080" width="100%">
<tr>
<td valign="middle" align="center"><a href="http://www.mytreasurespot.com/new"><img border="0" src="http://www.mytreasurespot.com/new/logos/tslogo.gif" width="458" height="118"></a><br>
</td>
</tr>
</table>
</div>
<center>
<br>
Scan the hunt field using your mounse cursor. When you find a target the cursor will<br>
change shape (usually change to a hand). Click on that area to reveal your find.<br>
Difficulty Setting = Very Hard-> <b><i>1</i></b> 2 3 4 5 6 7 8 9 10 <-Very Easy<br>
<b><i>This is a Test Hunt...No prizes are being given away...Practice and testing only!</i></b><br>
<img src="http://www.mytreasurespot.com/new/hunt/huntfield.jpg" border="0" usemap="#huntfield">
<map name="huntfield">
<area href="http://www.mytreasurespot.com/new/hunt/hunt03.html" onMouseOver="playSound(0)" onMouseOut="stopSound(0)" ALT="Target Found...Click To Dig!!!" shape="circle" coords="487,48,10">
</map>
<br>
</center>
</body>
</html>