Re: Java Script is messing up.

Brian Medendorp (medendob@lahs.losalamos.k12.nm.us)
Mon, 2 Mar 1998 11:18:15 -0700 (MST)


Date: Mon, 2 Mar 1998 11:18:15 -0700 (MST)
From: Brian Medendorp <medendob@lahs.losalamos.k12.nm.us>
To: Robert Hart <ab6rah@bath.ac.uk>
cc: Vidyut Luther <vluther@doconline.com>,
In-Reply-To: <Pine.SOL.3.93.980302165038.10563A-100000@ss1.bath.ac.uk>
Message-ID: <Pine.SGI.3.96.980302111714.15499A-100000@lahs.losalamos.k12.nm.us>
Subject: Re: Java Script is messing up.

Yes, I know this problem. all you really have to do is writre a script to
detect the browser and tell it not to use the preloading code in IE 3.0,
it just won't work with that browser....

                                         - [3rian  :)

"I *loooove* horse manure." 
	-Elaine Benes

On Mon, 2 Mar 1998, Robert Hart wrote:

> I'm sorry, but this doesn't work in IE3.0 . I'd like it to, but it doesn't.
> I get error line 10 Image is not defined or something.
> 
> 
> On Fri, 27 Feb 1998, Brian Medendorp wrote:
> 
> ->	I'm not sure if this is causing your problem, but the &quot; and
> ->using the actuall numerical index value, may be causeing at leat some
> ->problems. Also IE 3.0 does not do a very good job with javascript and has
> ->peoblems witht the rollovers anyway. Try using this code instead:
> ->
> -><SCRIPT LANGUAGE="JavaScript">
> ->
> ->
> -><!-- hide script
> ->
> ->//image preload
> ->        mainu = new Image();
> ->        mainu.src = "images/main.gif";
> ->        mainh = new Image();
> ->        mainh.src = "images/main-h.jpg";
> ->        broadcasth = new Image();
> ->        broadcasth.src = "images/broadcast-h.jpg";
> ->        coolh = new Image();
> ->        coolh.src = "images/cool-h.jpg";
> ->        coolc = new Image();
> ->        friendsh = new Image();
> ->        friendsh.src = "images/friends-h.jpg";
> ->        searchh = new Image();
> ->        searchh.src = "images/search-h.jpg";
> ->        mailh = new Image();
> ->        mailh.src = "images/mail-h.jpg";
> ->
> ->//MouseOver Function
> ->function LightUp(ImageX,Text) {
> ->   document[ImageX].src = "images/" + ImageX + "-h.jpg";
> ->        window.status = Text
> ->}
> ->//MouseOut Function
> ->function DimDown(ImageX) {
> ->   document[ImageX].src = "images/" + ImageX + ".gif";
> ->        window.status=''
> ->}
> ->//End JS Script hide-->
> ->
> ->
> -></SCRIPT>
> ->
> ->if you wish to see this code in action go to:
> ->http://saturn.lahs.losalamos.k12.nm.us/medendob/hwl/index.html
> ->
> ->
> ->                                         - [3rian  :)
> ->
> ->"I'm not sure, and correct me if I'm wrong, but I think I see a nipple." 
> ->	-Jerry Seinfeld
> ->
> ->On Fri, 27 Feb 1998, Vidyut Luther wrote:
> ->
> ->> Hi, 
> ->>  My question is regarding JavaScript and it's compatibility with browsers.
> ->> 
> ->> I am working on a web page, and this is my first attempt at javascript,
> ->> I'm attempting to do mouse overs, but i've been getting some wierd errors,
> ->> when the page is viewed by different browsers.
> ->> 
> ->> I designed the page using communicator 4.03 as the preview browser and
> ->> notepad as the editor. anyway here is the source for the javascript and
> ->> then i'll try and explain what it's supposed to do, and what the error
> ->> messages are.
> ->> 
> ->> <HTML>
> ->> <HEAD>
> ->> 
> ->> <SCRIPT language="javascript">
> ->> function buttonSwap(idx, newImage)
> ->> {document.images[idx].src = newImage;}
> ->> </SCRIPT>
> ->> <TITLE> Doc Online </TITLE>
> ->> <BODY >
> ->> <TABLE>
> ->> <TR>
> ->> <td  colspan=2><CENTER>
> ->> <A HREF="news/index.html" onMouseOver="buttonSwap(1,&quot;newsbot.gif&quot;)" onMouseOut="buttonSwap(1, &quot;newsup.gif&quot;)">
> ->> <IMG SRC="newsup.gif" BORDER=0></A></CENTER>
> ->> </TD></TR>
> ->> </TABLE>
> ->> </BODY>
> ->> </HTML>
> ->> if you see the code, you'll realize that it's a simple onmouseover, and
> ->> onmouse out function.  it works great in communicator 4.03. But when i
> ->> tried to view it using IE 3.01, i got a javascript error, it said
> ->> something about image can't be used as an array, and the same thing using
> ->> netscape 2.02.  
> ->> 
> ->> But, when it's viewed through netscape 3.0, the whole page loads up fine
> ->> and dandy, but once the mouse goes over any of the images on the table,
> ->> another image is loaded up, but not right over the old image, it seems the
> ->> new image is loaded a few pixels over the original image.  I can't figure
> ->> out why this is happening. can anyone help ?
> ->> 
> ->> to see the whole page and it's whole cde point your browsers at
> ->>  
> ->> http://www.doconline.com
> ->> any help on this would be greatly apreciated
> ->> 
> ->> 
> ->> Vidyut Luther 
> ->> http://www.doconline.com
> ->> E-Mail:vluther@doconline.com
> ->> 
> ->
> 
> +-------------------------------------+
> | "It's only a trap if you don't take |
> | a ladder with you to get out of it" |
> | 		-S Ring, Bath Uni     |
> |                                     |
> | ab6rah@bath.ac.uk                   |
> | http://www.bath.ac.uk/~ab6rah       |
> +-------------------------------------+
>