mouseover on all browsers

N

Nick

I can't make out why this won't work in iexplorer (even when I change
'Netscape'). The mouse over works fine in >Netscape 4 and Opera 5 and
7. Is it a simple fix or is that wishful thinking?

Regards
N

etc
</HEAD>

<script language="JavaScript">
<!--
function bboatssw_exchange_src(name, rpath, nsdoc)
{
str = (navigator.appName == 'Netscape') ? nsdoc+'.'+name :
'document.all.'+name;
img = eval(str);
if (img) {
if (img.altsrc == null) {
img.altsrc = img.src;
img.src = rpath;
} else {
var temp = img.src;
img.src = img.altsrc;
img.altsrc = temp;
}
}
}

function bboatssw_preload_img()
{
var img_list = bboatssw_preload_img.arguments;
if (document.preloadlist == null)
document.preloadlist = new Array();
var top = document.preloadlist.length;
for (var i=0; i < img_list.length; i++) {
document.preloadlist[top+i] = new Image;
document.preloadlist[top+i].src = img_list;
}
}

//-->
</script>

<BODY bgColor=#000000 leftMargin=0 topMargin=0 marginheight="0"
marginwidth="0" text="#f7e6eb" link=#dbcae6
vLink=#cbb0db aLink=#cccae6>
<TABLE border=0 cellPadding=0 cellSpacing=0>

<TR>
<TD width="138"><IMG height=189 src="pieces/one.jpg"
width=138></TD>
<TD width="586" valign="top"><IMG height=189 src="pieces/two2.jpg"
width=611></TD>
</TR>
<TR>
<TD vAlign=top width="138" height="414"> <IMG height=46
src="pieces/three.jpg" width=138>
<A onmouseover="bboatssw_exchange_src('image1', 'pieces/fourover.jpg',
'document')" onmouseout
="bboatssw_exchange_src('image1', 'pieces/fourover.jpg', 'document')"
href="bullshit1.html" ><IMG height=47
alt=four.jpg src="pieces/four.jpg" width=138 border=0
name=image1></A>

ETC ETC
 
L

Lasse Reichstein Nielsen

I can't make out why this won't work

What doesn't work? Does nothing happen or does the wrong thing happen?
in iexplorer (even when I change 'Netscape'). The mouse over works
fine in >Netscape 4 and Opera 5 and 7. Is it a simple fix or is that
wishful thinking?
<script language="JavaScript">

The type attribute is required in HTML 4.0+

HTML comments are not needed in Javascript.
function bboatssw_exchange_src(name, rpath, nsdoc)
{
str = (navigator.appName == 'Netscape') ? nsdoc+'.'+name :
'document.all.'+name;
img = eval(str);

Declare your variables as local to avoid polluting the global
namespace.

You never need eval to access object properties or variables.

These two lines can be changed to just:
var img = document.images[name];

It works in pretty much any browser later than Netscape 2.

/L
 
N

Nick

Lasse Reichstein Nielsen said:
What doesn't work? Does nothing happen or does the wrong thing happen?
Thanks for replying. "Doesn't work" in this context means that
images do not even appear - just the cyber box where they should
(either mouse over or not)- in IE, where as everything is normal in
the other browsers (ie the images, differing shades, alternate on
mouseover off movement)work as expected.


Thanks again for your input
N
 
N

Nick

Additionally replaced the two lines with the one you suggested. The
good news is it still works as before. The bad news but still not in
IE (v5.5). No images anywhere (even the ones that don't involve a
mousever. Maybe that's a clue. Does it require a different type of
dir path to the images?).

Regards
N
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top