>  기사  >  웹 프론트엔드  >  啊,一个小的html页面,怎么提交总是提示我函数错误_html/css_WEB-ITnose

啊,一个小的html页面,怎么提交总是提示我函数错误_html/css_WEB-ITnose

WBOY
WBOY원래의
2016-06-21 09:09:54933검색

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>注册页面</title><script type="text/javascript">	function checked(){		var loginname = document.getElementById("loginname").value;		if(loginname == ""){			alert("用户名不能为空");			return false;		}		var password = document.getElementById("password").value;		if(password == ""){			alert("密码不能为空");			return false;		}		document.loginform.submit();	}</script></head><body><center>	<h2>注册新用户</h2>	<form method="post" name="regist" action="login" id="loginform">	<table border="0">		<tr>			<td>用户名</td>			<td><input type="text"  id="loginname" name="loginname"/></td>		</tr>		<tr>			<td>密 码</td>			<td><input type="password"  id="password" name="password"/></td>		</tr>		<tr id="sex">			<td>男:<input type="radio" value="男" name="sex" /></td>			<td>女:<input type="radio" value="女" name="sex" /></td>		</tr>		<tr>			<td>年 龄:</td>			<td><input type="text" id="age" name="age" /></td>		</tr>		<tr>			<td><input type="reset" value="重置"/></td>			<td><input type="button" value="确认" onclick="checked();" /></td>		</tr>	</table>	</form></center></body></html>

只要提交IE9就报错说是checked()缺少函数,小弟实在是找不出来错误了


回复讨论(解决方案)

函数名称换个

换个名称,要不是不是认为checked 是 复选框或者单选框的属性了?

楼主不要用checked,,,,这是保留字符。。。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.