HighDots Forums  

Testing when an Image is Loaded

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Testing when an Image is Loaded in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
virtgolfer
 
Posts: n/a

Default Testing when an Image is Loaded - 07-13-2004 , 12:16 AM






the following script looks for am image in the current directory, and if not
found goes up a level, one by one until the image is found or we are at the
root directoy. It works greatl however sometimes it does not detect the image
unless i place a pause on the line indicated below.

How do I test to see if an image is in the process of loading and when it has
completed loading. In NN there is an onLoad event; how do I do it in IE?

Here is the code.


<script language="JavaScript">
Page_URL = document.URL;URL = "Page_picture.gif";y = Page_URL.length
while (y>4) {
tester=new Image();tester.src=URL;

// need a slight pause to load file
if (tester.fileSize > 0) break

for (y = y; y>1; y--) {
if (Page_URL.charAt(y) == "/") {
URL=Page_URL.slice(0,y)+"/Page_picture.gif"
y--
break
}
}
}

document.write("<img src= '"+tester.src+"' width=\"188\" height=\"188\">")
</script>



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.