javascript不执行 高手帮我看看 哪里出了问题 谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/22 15:36:21
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<SCRIPT language=javascript>
function mysubmit()
{
if(document.form1.username.value=="")
{
alert("请输入用户名!");
document.form1.username.focus();
return false;
}
if(document.form1.password.value == "")
{
alert("请输入密码!");
document.form1.password.focus();
return false;
}
return true;
document.form1.submit();

}
</SCRIPT>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<styl

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
这行不要!

return true;
document.form1.submit();
问题出在这,你都已经return true了,你后面这句submit();他跟本不会在执行了

没问题啊 我试了

你好像没调用mysubmit() 这个函数吧?

你的这段代码,一点问题没有,可以执行,你执行不了,可能是你的浏览器不支持里面的代码.你把我的这个COPY进去试试
我这个符合W3C
<!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" />
<