onLoad event and pre caching images

S

Stuart

I am very new to javaScript, and I am hoping someone can explain the
differance between the following two browsers and how to deal with thier
differant approach to firing the onLoad event.

The following web page is for my own use only, therefor I am uninterested in
the Netscape platform.

At home I have the following browser "Microsoft Internet Explorer4.0
(compatible; MSIE 5.0; Windows 98; DigExt)" and my web page loads as
planned. The onLoad event is fired when all the images are loaded, and until
they are fully loaded progreess can be followed on the status bar.

At work I have "Microsoft Internet Explorer4.0 (compatible; MSIE 6.0;
Windows 98)"... Now this performs very differantly, The onLoad event is
fired as soon as the HTML is loaded (which is a very long time before all
the images are loaded) Also, because the browser considers loading to be
complete, No progress on the images downloading is given on the status bar.


The following link is to the first page, this gives the link to the second
page that is causing the headache. If you do decide to view the page, choose
4 days at 24 hours!

http://www.stuartstuart.fsnet.co.uk/other/gfsindex.htm

As I am new to javaScript, I would welcome any advice / sugestions as to
writing style and improvements that I could make

regards
Suart

the following is the script :-

<Script>
var dwellTime=2
var pos=''
if (location.href.indexOf('?')!= -1){
qwert =location.href.slice(location.href.indexOf('?')+1)
var dy=qwert.slice(2)
var int=qwert.slice(0,2-qwert.length)
}
parent.window.moveTo(0,0)
parent.window.resizeTo(screen.availWidth,screen.availHeight)
if(screen.width==800){
var wth=632;var hgt=518
}else{
var wth=790;var hgt=648
}
var pics=(24/int)*dy
var img=new Array()
var hrs=''
for(var i=0;i<pics;i++){
hrs=i*int
if (hrs==0){hrs='00'}
img = new Image(wth,hgt)
img.src= 'http://129.13.102.67/wz/pics/Rtavn'+hrs+'1.gif'
}

function opener(){
document.images[0].src=img[0].src
pos=0
}

function fire(q){
if(q>0){pos++}else{pos--}
if (pos==-1){pos=img.length-1}
if (q==1&&pos==img.length){pos=0}
document.images[0].src=img[pos].src
}
function auto(b){
if (b){
pos++
if (pos==img.length){pos=0}
document.images[0].src=img[pos].src
timerID=setTimeout("auto(1)",dwellTime*1000)
}else{
clearTimeout(timerID)
return
}
}


function dwell(t){
if(t){
dwellTime=dwellTime+0.5
}else{
dwellTime=dwellTime-0.5
if (dwellTime<0){dwellTime=0}
}
}
</Script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top