高效的JavaScript代碼單元測試方法(3)
發表于:2013-01-11來源:web開發社區作者:Hazem Saleh點擊數:
標簽:JavaScript
04 05 appnamespace.ApplicationUtil.prototype.validateLoginForm = function (){ 06 var error = true ; 07 document.getElementById ( usernameMessage ).innerText = ; 08 document.getElementById ( passwordMe
05 |
appnamespace.ApplicationUtil.prototype.validateLoginForm = function (){ |
07 |
document.getElementById ( "usernameMessage" ).innerText = "" ; |
08 |
document.getElementById ( "passwordMessage" ).innerText = "" ; |
10 |
if (!document.getElementById ( "username" ).value) { |
11 |
document.getElementById ( "usernameMessage" ).innerText = |
12 |
"This field is required" ; |
16 |
if (!document.getElementById ( "password" ).value) { |
17 |
document.getElementById ( "passwordMessage" ).innerText = |
原文轉自:http://www.anti-gravitydesign.com