What's wrong with this javascript? -
i'm using javascript switch out tables based on time. i'm getting error in dw.
<script type="text/javascript"> <!-- function changewebsite() { var currenttime = new date().gethours(); if (7 <= currenttime&¤ttime < 18) { document.write(' <table id="table_01" width="200" height="400" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_vc01.png" width="200" height="45" alt=""></td> </tr> <tr> <td> <a href="http://www.itsnotch.com" onmouseover="window.status='visit biography website'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_vc02.png" width="200" height="75" border="0" alt="itsnotch.com"></a></td> </tr> <tr> <td> <a href="http://www.notchtheguru.com" onmouseover="window.status='my tumblr'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/notchtheguru.comvc.png" width="200" height="119" border="0" alt="tumblr"></a></td> </tr> <tr> <td> <a href="http://www.bignotch.com" onmouseover="window.status='welcome music website'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_vc04.png" width="200" height="161" border="0" alt="notchtheguru.com"></a></td> </tr> </table> <br> '); } else { document.write(' <table id="table_01" width="200" height="400" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_01.png" width="200" height="45" alt=""></td> </tr> <tr> <td> <a href="http://www.itsnotch.com" onmouseover="window.status='visit biography website'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_02.png" width="200" height="75" border="0" alt="itsnotch.com"></a></td> </tr> <tr> <td> <a href="http://www.notchtheguru.com" onmouseover="window.status='my tumblr'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/notchtheguru.com.png" width="200" height="119" border="0" alt="tumblr"></a></td> </tr> <tr> <td> <a href="http://www.bignotch.com" onmouseover="window.status='welcome music website'; return true;" onmouseout="window.status=''; return true;"> <img src="http://itsnotch.com/tumblr/images/websitelist_tumblr_04.png" width="200" height="161" border="0" alt="notchtheguru.com"></a></td> </tr> </table> <br> '); } } changewebsite(); -->
the error on line 7 'document.write('
- javascript not support multiline strings.
you have unescaped single quotes inside of string (which delimited single quotes).
example, must change:onmouseover="window.status='visit biography website';
to:
onmouseover="window.status=\'visit biography website\';
for detailed information, run code through jslint.
warning: jslint hurt feelings.
Comments
Post a Comment