...

View Full Version : onmouseover effect for netscape and internet explorer not working



allyson
07-07-2002, 04:28 AM
Hi

The following script is supposed to write text as the mouse is rolled over certain images. The text is written on another part of the screen. I wanted it to work in Netscape and Internet Explorer. Unfortunately the script does not work. The script is at http://homepages.ihug.co.nz/~usateden/panacea/entrytest.htm Can anyone help please?

<html>
<head>
<title>Panacea Art</title>
<base href="http://homepages.ihug.co.nz/~usateden/panacea/">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<style type="text/css">

.mouseText {
font: 200 20px "comic sans ms";
color: sienna;
}
.logo {
font-weight: bold;
color: crimson;
}

</style>
<script type="text/javascript" language="javascript">

var MO_text = new Array();
MO_text[1] = 'Find out who is the <span class="logo">Panacea</span> Artist of the
Month';
MO_text[2] ='Come in and see the <span class="logo">Panacea</span> Art Gallery';
MO_text[3] = 'Find out about the <span class="logo">Panacea</span> Arts Trust';

function getCell(id) {
return document.all ? document.all(id) :
document.getElementById ? document.getElementById(id) :
document.layers ? document['NS' + id].document.layers[0] : null;
}

function setCell(id, content, classname) {
var c = getCell(id);
if (!document.layers) {
c.innerHTML = content;
if (classname) c.className = classname;
} else {
var sSPAN = ((classname) ? '<span class="' + classname + '">' : '<span>');
c.document.write(sSPAN + content + '</span>');
c.document.close();
c.parentLayer.clip.width = c.clip.width;
c.parentLayer.clip.height = c.clip.height;
}
}

</script>
<body background="images/bg1.jpg">
<p align="center"><img src="images/titlelogo.GIF" width="220" height="54"></p>
<p> </p>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="227" valign="bottom"><a href="artistofmonth.htm" target="_top"
onmouseover="setCell('textcell',MO_text[1],'mousetext')"
onmouseout="setCell('textcell','')" ;>
<img src="first.GIF" border="0" width="227" height="138"></a></td>
<td width="183" valign="bottom" colspan="2"><a href="#" target="_top"
onmouseover="setCell('textcell',MO_text[2],'mousetext')"
onmouseout="setCell('textcell','')">
<img src="second.GIF" width="183" height="138" border="0"></a></td>
</tr><tr>
<td width="227" valign="top">
<a href="frameset/index.html" target="_top"
onmouseover="setCell('textcell',MO_text[3],'mousetext')"
onmouseout="setCell('textcell','')">
<img src="third.GIF" width="227" height="168" border="0"></a></td>
<td width="180" valign="top"><img src="fourth.GIF" width="180" height="167"></td>
<td id="textcell" width="410" valign="top"><ilayer
id="NStextcell"><layer></layer></ilayer>
</td>
</tr>
</table>
</div>
</body>
</html>

bye
Allyson

Gordo
07-07-2002, 11:00 AM
See the following line in your script?

MO_text[1] = 'Find out who is the <span class="logo">Panacea</span> Artist of the Month';

If you look at your source code, you'll notice that the word "Month" falls on the next line. This is disabling the entire deal. This line of code has to be on one line (only).

Try that. If it's still inoperable, come back and let us know so that we may assist you further.

Good luck.

adios
07-07-2002, 11:50 PM
This belongs as a continuation of this thread:

http://www.codingforums.com/showthread.php?threadid=1458

It might also be accompanied by a 'thanks for helping', but, not holding my breath. I can't help it if this editor breaks lines (or people copy them incorrectly).

adios :mad:

allyson
07-08-2002, 01:21 AM
Hi

Thank-you very much for this script. It works really well, and has achieved exactly what I was after. However, I've added another, introductory, message into the MO_text[0] array and I would like to display that message, everytime that the onmouseover messages do not display. I need a never ending loop function which says that if message="" then message=MO_text[O].


Thank-you for all your help.

bye
Allyson

adios
07-08-2002, 01:49 AM
<html>
<head>
<title>Panacea Art</title>
<base href="http://homepages.ihug.co.nz/~usateden/panacea/">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<style type="text/css">

.mouseText {
font: 200 20px "comic sans ms";
color: sienna;
}
.logo {
font-weight: bold;
color: crimson;
}

</style>
<script type="text/javascript" language="javascript">

var MO_text = new Object();
MO_text['default'] = 'Introductory message (default)';
MO_text['artist_of_month'] = 'Find out who is the <span class="logo">Panacea</span> Artist of the Month';
MO_text['see_gallery'] ='Come in and see the <span class="logo">Panacea</span> Art Gallery';
MO_text['arts_trust'] = 'Find out about the <span class="logo">Panacea</span> Arts Trust';

function getCell(id) {
return document.all ? document.all(id) :
document.getElementById ? document.getElementById(id) :
document.layers ? document['NS' + id].document.layers[0] : null;
}

function setCell(id, content, classname) {
var c = getCell(id);
if (!document.layers) {
c.innerHTML = content;
if (classname) c.className = classname;
} else {
var sSPAN = ((classname) ? '<span class="' + classname + '">' : '<span>');
c.document.write(sSPAN + content + '</span>');
c.document.close();
c.parentLayer.clip.width = c.clip.width;
c.parentLayer.clip.height = c.clip.height;
}
}

</script>
<body background="images/bg1.jpg">
<p align="center"><img src="images/titlelogo.GIF" width="220" height="54"></p>
<p> </p>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="227" valign="bottom"><a href="artistofmonth.htm" target="_top"
onmouseover="setCell('textcell',MO_text['artist_of_month'],'mousetext')"
onmouseout="setCell('textcell',MO_text['default'])" ;>
<img src="first.GIF" border="0" width="227" height="138"></a></td>
<td width="183" valign="bottom" colspan="2"><a href="#" target="_top"
onmouseover="setCell('textcell',MO_text['see_gallery'],'mousetext')"
onmouseout="setCell('textcell',MO_text['default'])">
<img src="second.GIF" width="183" height="138" border="0"></a></td>
</tr><tr>
<td width="227" valign="top">
<a href="frameset/index.html" target="_top"
onmouseover="setCell('textcell',MO_text['arts_trust'],'mousetext')"
onmouseout="setCell('textcell',MO_text['default'])">
<img src="third.GIF" width="227" height="168" border="0"></a></td>
<td width="180" valign="top"><img src="fourth.GIF" width="180" height="167"></td>
<td id="textcell" width="410" valign="top"><ilayer id="NStextcell"><layer>
<span class="mouseText">Introductory message (default)</span>
</layer></ilayer>
</td>
</tr>
</table>
</div>
</body>
</html>

allyson
07-08-2002, 03:53 AM
Hi

Thank-you very much for this fantastic script.
:)

bye
Allyson



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum