Connecting Tech Pros Worldwide Forums | Help | Site Map

mouseover on all browsers

Nick
Guest
 
Posts: n/a
#1: Jul 20 '05
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[i];
}
}

//-->
</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

Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: mouseover on all browsers


nicklin@hotmail.com (Nick) writes:
[color=blue]
> I can't make out why this won't work[/color]

What doesn't work? Does nothing happen or does the wrong thing happen?
[color=blue]
> 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?[/color]
[color=blue]
> <script language="JavaScript">[/color]

The type attribute is required in HTML 4.0+
<script type="text/javascript">
[color=blue]
> <!--[/color]

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

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
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Nick
Guest
 
Posts: n/a
#3: Jul 20 '05

re: mouseover on all browsers


Lasse Reichstein Nielsen <lrn@hotpop.com> wrote in message news:<n0bm4uos.fsf@hotpop.com>...[color=blue]
> nicklin@hotmail.com (Nick) writes:
>[color=green]
> > I can't make out why this won't work[/color]
>
> What doesn't work? Does nothing happen or does the wrong thing happen?
>[/color]
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
Nick
Guest
 
Posts: n/a
#4: Jul 20 '05

re: mouseover on all browsers


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
Closed Thread