FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

I need a loading bar that appears while (read inside)

 


venc
the page is loading, can someone give me the code to do this?
hexkid
venc wrote:
the page is loading, can someone give me the code to do this?


Not sure this is what you want:
Code:
<html>
<head>
  <title>test</title>
</head>
<body onload="document.getElementById('content').setAttribute('style', 'display:block');document.getElementById('loading').setAttribute('style', 'display:none');">
<div id="loading">the page is loading</div>
<div id="content" style="display:none">
   <img src="http://nosheep.net/wp-content/upload/random_kittens.jpg" width="200px" height="200px">
</div>
</body>
</html>


WARNING: The image used above (found with a Google search) is 2576 x 1932 pixels - 1425k!
venc
ok, thanks man!
venc
uh, yeah, didnt work, 'cause it always shows the text "page is loading" and not just when its loading
The Conspirator
It works in Fire Fox, it doesn't work in Opera, it never shows the "the page is loading". It doesn't work in crapE it only, shows "the page is loading"
venc
ok...dont see how that helps...but thanks.
hexkid
The Conspirator wrote:
It works in Fire Fox, it doesn't work in Opera, it never shows the "the page is loading". It doesn't work in crapE it only, shows "the page is loading"
From that you can learn two things:
1. I use Firefox Smile
2. I don't know JavaScript

venc wrote:
uh, yeah, didnt work, 'cause it always shows the text "page is loading" and not just when its loading
Tweak the JavaScript bit until it works for you. Or better yet, tweak it until it works for everybody including those people that browse with JavaScript disabled.
The Conspirator
Code:
<html>
<html>
   <head>
      <title>test</title>
   </head>
   <body onload="document.getElementById('content').style.display='block';document.getElementById('loading').style.display='none';">
      <noscript>
         Your browser ether dose not support java script or java scripts has been disabled. Pleas update your browser or tern on java script support.
      </noscript>
      <div id="loading">the page is loading</div>
      <div id="content" style="display:none">
         <img src="http://nosheep.net/wp-content/upload/random_kittens.jpg" width="200px" height="200px">
      </div>
   </body>
</html>

This works in all 3.
Unfortunately you can not make it work if hey do not have java script support or have terned it off. But thats what <noscript> is for.
hexkid
The Conspirator wrote:
This works in all 3.
Unfortunately you can not make it work if hey do not have java script support or have terned it off. But thats what <noscript> is for.

Thank you very much for another trick I can put in my bag of tricks.
venc
thanks man, I will go see if it works!
jayzee
works perfect for me...
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.