我很难在我为一个班级设计的看似简单的 HTML/Javascript 页面中找到错误。我花了几个小时查看此页面的代码(以及其他 3 个让我发疯的代码)。我想知道是否有一些语法被我漏掉了?在此页面中,我们将编写一个脚本来破译客户是否超过了他们的信用额度。在此页面和其他 3 个页面中,onclick 事件似乎不起作用。这是完整的代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Homework 3 Part 3</title>
<style type="text/css">
tr.visiting {background-color: #000000; }
h1.header {color: #333333;}
.creditbox {
background-color: #ffcc66;
width: 60%;
border:solid 5px #666666;
margin-left:auto;
margin-right:auto;
}
table {
text-align: right;
}
td.visiting {background-color: #000000; }
input {text-align: right;}
</style>
<script type="text/javascript">
/* <![CDATA[ */
function creditCalc()
{
var account, credLim, begBalance, totalCharged, credit, balance, endBalance;
account = parseInt(document.creditLimitForm.accountNum.value);
credLim = parseInt(document.creditLimitForm.creditLimit.value);
begBalance = parseInt(document.creditLimitForm.beginningBalance.value);
totalCharged = parseInt(document.creditLimitForm.amtCharged.value);
credit = parseInt(document.creditLimitForm.creditsApplied.value);
balance = begBalance + totalCharged;
endBalance = balance - credit;
documemt.creditLimitForm.creditDisplay.value("Account Number: " + account + "\nCredit Limit: " + credLim + "\nBeginning Balance: " + begBalance + "\nTotal Charged this month: " + totalCharged + "\nTotal credits this month: " + credit + "\nCredit Available: " + endBalance);
document.getElementById("creditAvailable").innerHTML = endBalance;
}
/*]]>*/
</script>
</head>
<body bgcolor = "#ffffff" alink = "#FFFFCC" link = "#FFFFCC" vlink = "#FFFFCC">
<table id="border" width="70%" align ="center" cellpadding="0">
<tr>
<td align="center">
<img src="hw3Banner.jpg" alt="Homework Banner" align="middle" />
</td>
</tr>
</table>
<br />
<table border="1" width="500" align ="center" bgcolor="#666666" cellpadding="2.5">
<tr><td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3.html">HW 3 Main</a></td>
<td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt1.html">Part 1</a></td>
<td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt2.html">Part 2</td>
<td class="visiting" align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt3.html">Part 3</a></td>
<td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt4.html">Part 4</a></td>
<td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt5.html">Part 5</a></td>
<td align = "center"><font face ="baskerville" color="#FFFFCC" /><a href="homework3pt6.html">Part 6</a></td></tr></table>
<br />
<div class="creditbox" align="center" >
<form name="creditLimitForm" action="">
<br />
<h1 class="header">Customer Credit Limit Check</h1>
<br />
<table class="creditLimitForm">
<tr>
<td>Customer Account Number:</td>
<td><input type="text" id="accountNum" name="accountNum" size="15" /></td>
</tr>
<tr>
<td>1st of Month Balance: </td>
<td>$<input type="text" id="beginningBalance" name="beginningBalance" size="15" /></td></tr>
<tr>
<td>Total charged by customer this month: </td>
<td>$<input type="text" id="amtCharged" name="amtCharged" size="15" /></td>
</tr>
<tr>
<td>Total credits applied to account </td>
<td>$<input type="text" id="creditsApplied" name="creditsApplied" size="15" /></td>
</tr>
<tr>
<td>Allowed Credit Limit</td>
<td>$<input type="text" id= "creditLimit" name="creditLimit" size="15" /></td>
</tr>
</table>
<br />
<textarea rows="7" cols="50" name="creditDisplay"></textarea>
<br /><br />
<input type="button" onclick="creditCalc();" value="Check Credit" />
<input type="reset" value="Reset Form" />
<p>Credit Available: </p>
<p id="creditAvailable"></p>
</form>
<br />
<br />
</div>
</body>
</html>
任何可以来救援的优秀调试器?