我有兩個文本框,我需要將一個文本框的值填充到另一個文本框,並且在文本框中輸入的值應該僅爲數字。填充並檢查僅數值文本框
/* for numeric value in one textbox and populate in another*/
function onType(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
return false;
}
else{
document.getElementById("marketValuationId").value=document.getElementById("valuationId").value;
return true;
}
你有什麼問題? – codebox
那麼究竟發生了什麼確切的問題..這個onType()被附加到哪個文本框? – bhatanant2
'event' should also be'evt' –