Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > mouseover on all browsers

Reply
Thread Tools

mouseover on all browsers

 
 
Nick
Guest
Posts: n/a
 
      10-27-2003
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
 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      10-27-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (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 - (E-Mail Removed)
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
 
Nick
Guest
Posts: n/a
 
      10-28-2003
Lasse Reichstein Nielsen <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> (E-Mail Removed) (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
 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      10-28-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Browsers, browsers! Quo vadis? El Kabong HTML 23 05-13-2007 08:55 PM
Two Browsers work! Two browsers won't load. Internet game service won't load jimmie Computer Support 1 02-26-2006 08:36 AM
Mac.Netskape - Server error ! all other browsers - OK TJmaster ASP .Net 1 02-24-2005 04:50 PM
Point and Click Weather Forecasts does not work on all browsers. Why not? Francis Ardi Java 3 07-10-2003 05:26 PM
Point and Click Weather Map does not work on all browsers Francis Ardi Java 0 07-10-2003 05:32 AM



Advertisments