求助:表单数据不能提交到javascript函数里。不知道哪里错了?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>系统</title>
<link rel=stylesheet href="style.css" type="text/css">
<script type="text/javascript">
function jumpbj()
{
var bj=document.getElementById("banji");
alert(bj); if(bj.value>=1&&bj.value<=40)
{var myurl='teacher-'+bj+'.asp';
var str = 'window.open("' + myurl + '")';
eval(str);
return true;}
else
{alert("你输入的班级代码不对,请从新输入!");
return false;}
}
//-->
</script>
<style type="text/css">
<!--
.STYLE1 {
font-size: large;
color: #FF0000;
font-weight: bold;
font-family: "宋体";
}
body {
background-image: url(bg2003.gif);
}
.STYLE2 {font-family: "宋体"}
-->
</style>
</head>
<body topmargin="0">
<p> </p>
<p> </p>
<div align="center">
<!--#include file="top.asp"--><div align="center">
<center> </div>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"> <p> </p>
<table width="90%" border="1" align="center" cellpadding="3" cellspacing="3" bordercolorlight="#008080" bordercolordark="#FFFFFF" id="b1">
<!--DWLayoutTable-->
<form action="" method="post" name="form" onsubmit="return jumpbj()">
<tr>
<td width="457" height="27" valign="top"><span class="STYLE3">请输入你的班级代码:</span>
<input name="banji" type="VarNumeric" id="banji" size="6" >
<label>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>
================================================
代码中红色的 alert(bj);显示为[object],asp表单中的bj没有被提取或提交?
------解决方案--------------------
var myurl='teacher-'+bj.value+'.asp'
另外少用eval 直接window.open(myurl);