<%@page contentType="text/html;charset=gb2312"%>
<html>
<head>
<!-- 判断输入的是否为空,空的话就返回该焦点的javascript代码 -->
<script language="javasctipt" type="text/javascript">
function login(){
var form = document.thisForm;
if(trim(form.name.value) == ""){
window.alert("请输入姓名!");
form.name.select();
return;
}
if(trim(form.password.value) == ""){
window.alert("请输入密码!");
form.password.select();
return;
}
form.target = "_blank";
form.action = "isNull.jsp";
form.method = "post";
form.submit();
}
function trim(s) {
var count = s.length;
var st = 0;
var end = count-1;
if (s == "") return s;
while (st < count) {
if (s.charAt(st) == " ")
st ++;
else
break;
}
while (end > st) {
if (s.charAt(end) == " ")
end --;
else
break;
}
return s.substring(st,end + 1);
}
</script>
posted on 2009-09-04 12:15
孤飞燕 阅读(1461)
评论(0) 编辑 收藏 所属分类:
JS