上一个问题解决了又有新问题了
王政代码如下:
<html>
<head>
<title>Untitled Document</title>
<script language="JavaScript">
function myshow()
{
if(document.form1.schstyle.selectedIndex==0)
{
document.form1.schtype.options[0].text="今天";
document.form1.schtype.options[1].text="这一周";
document.form1.schtype.options[2].text="近一月";
document.form1.schtype.options[3].text="近两月";
}
else
{
document.form1.schtype.options[0].text="精确查询";
document.form1.schtype.options[1].text="模糊查询";
document.form1.schtype.options[2].text="前方一致";
document.form1.schtype.options[3].text="后方一致";
}
document.form1.schtype.options[0]selected=true;
}
</script>
</head>
<input type="button" onClick="myshow()" value="click me">
<body>
<form name="form1" method="post" action="search.php">
<input type="button" onClick="myshow()" value="click me">
查询方式:
<select name="schstyle" size="1" id="schstyle">
<option value="1">记者姓名</option>
<option value="2">文章标题</option>
</select>
匹配方式:
<select name="schtype" size="1" id="schtype">
<option value="0" selected id="option0">精确查询</option>
<option value="1" id="option1">模糊查询</option>
<option value="2" id="option2">前方一致</option>
<option value="3" id="option3">后方一致</option>
</select>
查询内容:
<input name="content" type="text">
<input type="submit" name="schsubmit" value="提交">
</form>
</body>
</html>
浏览器就是显示缺少对象,不只那儿出错了
王政代码如下:
<html>
<head>
<title>Untitled Document</title>
<script language="JavaScript">
function myshow()
{
if(document.form1.schstyle.selectedIndex==0)
{
document.form1.schtype.options[0].text="今天";
document.form1.schtype.options[1].text="这一周";
document.form1.schtype.options[2].text="近一月";
document.form1.schtype.options[3].text="近两月";
}
else
{
document.form1.schtype.options[0].text="精确查询";
document.form1.schtype.options[1].text="模糊查询";
document.form1.schtype.options[2].text="前方一致";
document.form1.schtype.options[3].text="后方一致";
}
document.form1.schtype.options[0]selected=true;
}
</script>
</head>
<input type="button" onClick="myshow()" value="click me">
<body>
<form name="form1" method="post" action="search.php">
<input type="button" onClick="myshow()" value="click me">
查询方式:
<select name="schstyle" size="1" id="schstyle">
<option value="1">记者姓名</option>
<option value="2">文章标题</option>
</select>
匹配方式:
<select name="schtype" size="1" id="schtype">
<option value="0" selected id="option0">精确查询</option>
<option value="1" id="option1">模糊查询</option>
<option value="2" id="option2">前方一致</option>
<option value="3" id="option3">后方一致</option>
</select>
查询内容:
<input name="content" type="text">
<input type="submit" name="schsubmit" value="提交">
</form>
</body>
</html>
浏览器就是显示缺少对象,不只那儿出错了
document.form1.schtype.options[0]selected=true;
应该是
document.form1.schtype.options[0].selected=true;
=>
document.all("schtype").options[document.all("schtype").selectedIndex].value
document.form1.schtype.options[0].selected=true;