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

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

WBOY
WBOYOriginal
2016-06-21 09:09:54931browse

<!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,,,,这是保留字符。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn