Guest Posted December 19, 2006 Share Posted December 19, 2006 Hi, This is a special use of JavaScript that will be included in the body section of an HTML page that is compiled into an .exe program (eBook). It is designed to run on the users PC, so it is dependent on Windows and therefore uses only the MSIE protocall. The script below is designed to display a small (1x1 pixel) graphic called "green.gif" if there is a current Internet connection on the PC. If the script returns an error (cannot download file), then the script should show "red.gif", with is stored in the ebook on the local PC. This effectively checks to see if the users PC is "online" and displays a warning if it is not. It looks and sounds simple enough, but I can't get it to work. When ran, it only prints the last part of the script out onto the screen like below: \n'; document.write(Out); If there are any JavaScript guru's here that could help me with this, I would really appreciate it !! The code is below: <script type='text/javascript'> Now=new Date(); Out='<img src=\"http://www.mywebsite.com/green.gif\ ?'+Now*1+'" onerror="this.onerror=null;this.src=\'red.gif\'\"/>\n'; document.write(Out); </SCRIPT> Daniel. Quote Link to comment 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.