DeanWhitehouse Posted June 29, 2008 Share Posted June 29, 2008 This is my code for my loader // JavaScript Document <!-- if (document.images) { pic1= new Image(); pic1.src="loader.gif"; } document.getElementById('main').style.visibility="hidden"; function loading() { document.getElementById("main").style.visibility="visible"; document.getElementById('loader').style.visibility="hidden"; document.getElementById('loader').style.marginTop="0%"; document.body.style.backgroundColor="#CCCCCC"; document.getElementById('loader').innerHTML = ' '; } //--> and this is the html side <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" media="screen" href="style.css"> <title>Mail App</title> <style type="text/css"> body { visibility:hidden; background-color:#000000; } .test { visibility:visible; margin-top:25%; } </style> <script type="text/javascript" src="main.js"></script> </head> <body onLoad="loading()"> <div id="loader" align="center" class="test"> <h1>Loading</h1> <br /><img src="loading.gif" alt="loading" align="absmiddle"></div> <div align="center" id="main"> <form action="mailapp.php" method="post" > To :<input type="text" value="" name="to" size="30" title="Enter The Recipients Email Address"> From :<input type="text" value="" name="from" size="30" title="Enter Your Email"> Subject :<input type="text" value="Enter A Subject" name="subject" size="30" title="Enter The Email Subject"> Message: <textarea title="Enter Your Message" name="message" rows="10" cols="100">Enter Your message here</textarea> <input type="submit" name="send" value="Send" title="Send The Email" size="30"> </form> </div> </div> </body> </html> And with this code , i don't think it is very effienct or very good, is there any ways to improve it, and is there any way that i can have this only run the function once, as the form is posting to its self i don't want it loading each time. Quote Link to comment https://forums.phpfreaks.com/topic/112391-js-loader-flawed/ Share on other sites More sharing options...
DeanWhitehouse Posted June 29, 2008 Author Share Posted June 29, 2008 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/112391-js-loader-flawed/#findComment-577282 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.