By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,517 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,517 IT Pros & Developers. It's quick & easy.

mouseover on all browsers

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ni*****@hotmail.com (Nick) writes:
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+
<script type="text/javascript">
<!--
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<n0**********@hotpop.com>...
ni*****@hotmail.com (Nick) writes:
I can't make out why this won't work


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
Jul 20 '05 #3

P: n/a
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
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.