為什么在Dreamweaver中使用JS來定義函數(shù)時會提示說有語法錯誤的?無法實現(xiàn)代碼。
<title>無標題文檔</title>
<script type="text/javascrip>
function check(){
? ? var un = document.getElementById("text1");
? ? var pw1 = document.getElementById("password1");
? ? var pw2 = document.getElementById("password2");
? ? if(un.value == "" || pw1.value == "") {
? ? ? ? alert("用戶名或密碼不能為空");
? ? ? ? return false;
? ? }
? ? if( pw1.value!=pw2.value){
? ? alert("密碼與確認密碼不一致");
? ? return false;
? ? }
}
</head>
2016-04-08
你在關閉head前加上</script>試試
2016-04-08
我發(fā)代碼給你看看吧:
<title>無標題文檔</title>
<script type="text/javascrip>
function check(){
? ? var un = document.getElementById("text1");
? ? var pw1 = document.getElementById("password1");
? ? if(un.value == "" || pw1.value == "") {
? ? ? ? alert("用戶名或密碼不能為空");? ? var pw2 = document.getElementById("password2");
? ? ? ? return false;
? ? }
? ? if( pw1.value!=pw2.value){
? ? alert("密碼與確認密碼不一致");
? ? return false;
? ? }
}
</head>
2016-04-07
截圖看看啊