<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>網頁特效|Linkweb.cn/Js|---輸入框測試警告</title>
</head>
<body>
<script language="JavaScript">
<!-- Hide
function test1(form) {
if (form.text1.value == "")
alert("您沒寫上任何東西,請再輸入一次 !")
else {
alert("嗨 "+form.text1.value+"! 您已輸入完成 !");
}
}
function test2(form) {
if (form.text2.value == "" ||
form.text2.value.indexOf('@', 0) == -1)
alert("這不是正確的 e-mail address! 請再輸入一次 !");
else alert("您已輸入完成 !");
}
// -->
</script>
<form name="first">
Enter your name:<br>
<input type="text" name="text1">
<input type="button" name="button1" value="輸入測試" onClick="test1(this.form)">
<P>
Enter your e-mail address:<br>
<input type="text" name="text2">
<input type="button" name="button2" value="輸入測試" onClick="test2(this.form)">
</body>
</html>