我使用JavaScript來根據時間切換表。但是我在DW中遇到錯誤。這個javascript有什麼問題?
<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 My 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 to My 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 My 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 to My 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();
-->
錯誤是在第7行了 'document.write('
什麼是錯誤? – kjy112 2011-03-07 18:32:23
只有按下ENTER鍵,才能在JavaScript字符串中分行。 – 2011-03-07 18:38:18
DW = dreamweaver? – 2011-03-07 18:39:57