简单的脚本如下:
<script type="text/javacript">
function DataValidate(){
var name = document.getElementById("name").value;
var password = document.getElementById("password").value;
if(name=="") alert(‘用户名不能为空!');
if(password=="") alert('密码不能为空!')
if (confirm('请确认您输入的资料.\r\r[确定] - 發送資料到服務器端.\r[取消] - 修改资料.')) {}
}
</script>
然后在提交按钮中加入οnclick="DataValidate()"这个代码就可以了。