• About Us
  • Search
  • Compatibility
  • Forums
  • Archive
  • Channels
  • Home
  • Search
  • Member List
  • Calendar
  • Help

Current time: 11-22-2008, 08:47 PM Hello There, Guest! (Login — Register)


Warp2Search - Your Daily Tech News Service / General Discussion / Warp2Search Hang Out / Javasript req?

Post Reply  Post Thread 
Threaded Mode | Linear Mode
Javasript req?
Author Message
El_Coyote
Senior Member
****


Posts: 555
Group: Registered
Joined: Dec 2002
Status: Offline
Reputation: 0
Post: #1
Javasript req?

i just wondered, does anyone know of a javascript that can handle replacing or not loading a item, for instance a picture or a swf, if the source of the server isnt responding, to reduce load/timouts?
Theres this queer server that doesnt respond at times, and that creates some timeout issues on the page im doing.


http://www.warp2search.net: News Editor
Never miss a good chance to shut up!
10-31-2003 12:01 PM
Find all posts by this user Quote this message in a reply
vicente
Member
***


Posts: 55
Group: Registered
Joined: Nov 2002
Status: Offline
Reputation: 0
Post: #2
 

this should help. the javascript u're looking for is the one below the 'img' tag(the big image/swf sits here). It should preferably be placed immediately below the 'img' to timeout image loading but can be placed anywhere
<HTML>
<SCRIPT>
var flag=0;//flag set to 1 when image is loaded
var timeoutval=10;//timeout for image load in milliseconds
</SCRIPT>
<BODY>
<p>in body1</p>
<img id="img1" onLoad="flag=1;" src="After party boys hang out.jpg"></img>
<script>

function func1(){
if(flag ==1)return;
obj=eval("document.all.img1");
if(obj == null) return;
obj.src="";
obj.alt="sorry";//error message here

}
setTimeout("func1()",timeoutval);


</script>
<p>in body2</p>
</BODY>
</HTML>

10-31-2003 12:39 PM
Find all posts by this user Quote this message in a reply
El_Coyote
Senior Member
****


Posts: 555
Group: Registered
Joined: Dec 2002
Status: Offline
Reputation: 0
Post: #3
 

ah looks great. thanks a bunch Smile


http://www.warp2search.net: News Editor
Never miss a good chance to shut up!
10-31-2003 02:54 PM
Find all posts by this user Quote this message in a reply
Degger*
Super Moderator
******


Posts: 646
Group: Super Moderators
Joined: Aug 2001
Status: Offline
Reputation: 0
Post: #4
 

Does this code also works with loading an other code instead of a picture ?

11-01-2003 02:05 PM
Visit this user's website Find all posts by this user Quote this message in a reply
El_Coyote
Senior Member
****


Posts: 555
Group: Registered
Joined: Dec 2002
Status: Offline
Reputation: 0
Post: #5
 

as long as you can put a id="xxx" on it, i think it can be used for most things.


http://www.warp2search.net: News Editor
Never miss a good chance to shut up!
11-01-2003 04:31 PM
Find all posts by this user Quote this message in a reply
vicente
Member
***


Posts: 55
Group: Registered
Joined: Nov 2002
Status: Offline
Reputation: 0
Post: #6
 

Besides images, the OnLoad event works for embedded objects( shockwave flash objects, applets) and the document (Body tag ) as a whole. But the onLoad event cannot be used for other tags besides the above. You can however alter attributes of all tags using scripting as the document loads

11-01-2003 05:22 PM
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump:

Contact Us | Warp2Search.Net | Return to Top | Return to Content | RSS Syndication

Powered By MyBB
Copyright © 2002-2008 MyBB Group