SunQuest
           HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 18th, 2000, 04:22 PM
$Brian $Brian is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 3 $Brian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
function leftchange() {
var leftimages = new Array(3);
for(var i = 0; i < 3; i++) {
leftimages[i] = new Image();
leftimages[i].src = "images/left" + i + ".gif";
}
var random = Math.floor(Math.random()*3);
left.src = leftimages[random].src;
setTimeout(leftchange, 3000);
}

There's my code. It is located in the head. In the body, I use an onLoad to call the function. Later on in the actual document, I call and <img name="left" src="whatever" width and height stuff>

Anyhow - ie 5.01 likes my code and causes the image to change. Netscape gives me an error saying that left is not defined and another person, unknown IE version was able to tell that img's were downloading, but not changing.

I'm not too good w/ JavaScript and so I'm hoping that someone can help me with this problem.

Thanx.

Reply With Quote
  #2  
Old April 19th, 2000, 07:30 AM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 741 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
are your images in a <div></div> (layer)?
if so you need to explicitly tell netscape where the image is so while ,

if(document.all){
document.images[img_name].src =img_src
} else {
document[img_name].src=img_src
}
works when there is only 1 layer you need -

if (document.all) {
document.images[img_name].src=img_src
} else {
document[div].document[img_name].src=img_src
}

for nested or multiple layers.

hope that helps?


------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
  #3  
Old April 19th, 2000, 02:07 PM
Argrajoca Argrajoca is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: SPAIN
Posts: 47 Argrajoca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
But in most cases, the easiest way is type document.left.src=.... instead of left.src alone, this way, you don't have to add anything else to your script

It works in NS

[This message has been edited by Argrajoca (edited April 19, 2000).]

Reply With Quote
  #4  
Old April 19th, 2000, 09:43 PM
$Brian $Brian is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 3 $Brian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanx for y'alls help.
I appreciate it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > IE 5.01 likes my code -> other's don't.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway