为什么不输入name 然后点submmit

HuoZuoZuo 2012-11-15 02:14:33

<html>
<head>
<script type="text/javascript">
function frmValid(obj)
{
// Elements array, initialization for validation
elems = new Array(
new Array(
'name', // name of elements to be validated
'value.length<1',
// validation condition
'Please identify yourself (by indicating your name), so that
your horoscope can be given!');
// prompt on failure
new Array(
'gender',
'value.length<1',
'Please select one'),
new Array(
'Zodiac',
'value.length<1',
'Zodiac is so important.Please write it!')
);

// Validate here, using eval statement.
for(i = 0; i < elems.length; i++)
{
with(eval('obj.'+elems[i][0]))
{
if(eval(elems[i][1]))
{
window.alert(elems[i][2]);
focus();
return false;
}
}
}
return true;
}
</script>
</head>
<body>
<form method ="get" action="http://localhost:8080/A/servlet/Horoscope"onsubmit="return frmValid(this)" >
<input name="name" type="text" onkeyup="this.value=this.value.replace(/[^a-zA-Z]/g,'')" onpaste="this.value=this.value.replace(/[^a-zA-Z]/g,'')"style="text-transform:capitalize;">enter your name<br>
please selct your gender
<p>
<label>
<input type="radio" name="gender" value="male">
male</label>
<br>
<label>
<input type="radio" name="gender" value="female">
female</label>
</p>
<p>please enter your Zodiac <br>
<input name="Zodiac" type="text" value=""onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'') ">
Zodiac</p>
<p>
<input type=submit value="send" >
</p>
</form>
</body>
</html>
...全文
54 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧