var totalEnteredCount = 0;
function totalEntered(field){
if(field.value != '')
{
totalEnteredCount++;
}
alert(Count);
if(totalEnteredCount == 3)
{
var IV = document.getElementById("IVUnit").value;
var FV = document.getElementById("FVUnit").value;
var Distance = document.getElementById("DUnit").value;
var Acceleration = document.getElementById("AUnit").value;
var Time = document.getElementById("TUnit").value;
}
}
這個函數在每次輸入或不輸入數據時都會從HTML調用onBlur。如果輸入數據,我希望它將totalEnteredCount增加1.但是全局變量是未定義的。有沒有辦法跟蹤函數被調用的次數?試圖追蹤Java腳本函數被調用的次數
HTML低於:
<td>Initial Velocity: </td>
<td> <input type = "textbox" name ="InitVelocityInput" onKeyPress="return isAcceptable(event)" onBlur = "totalEntered(this)" id = "IVUnit"> </td>
請接受解決你的問題的答案,這樣的問題可以關閉每次 – CrakC