跟你jscript的位置有关,
这样两个数值都可以的<body>
<form id="form1" name="form1">
<input type="text" name="sele" value="sele" value="sdf";>
</form>
<script>
document.write("aaa");
document.write(document.form1.sele.value);
</script></body>

解决方案 »

  1.   

    好象还是不行呀,我的基本程序是这样的:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><form name="form1" method="post" action="">
    <select name="select" onChange="show()">
    <option value="1">show the first layer1</option>
    <option value="2">show layer2</option>
    <option selected>select one</option>
    </select>
    </form>
    <script language="JavaScript">
    <!--
    function show(){
    document.write("aaa")
    document.write(document.form1.sele.value);
    document.write(document.form1.sele.options[document.form1.sele.selectedIndex].value);
    }
    //-->
    </script>
    </body>
    </html>
    上面后两种document.write好象都有点问题,不知怎么回事,望指点!
      

  2.   

    <select name="select" onChange="show()">
    document.write(document.form1.sele.value);select name错了
      

  3.   

    function show(){
    document.write("aaa")
    document.write(document.form1.sele.value);
    document.write(document.form1.sele.options[document.form1.sele.selectedIndex].value);
    }
    改成function show(){
    document.write(document.form1.sele.value+document.form1.sele.options[document.form1.sele.selectedIndex].value+"aaa");
    }
    具体原因估计出在document.write上面
      

  4.   


    把document.write(document.form1.sele.value);该为
    alert(document.form1.sele.value);如果还出错的话,就在每次write之后
    调用alert(document.body.innerHTML);检查一下
      

  5.   

    You should not use the write or writeln methods on the current document
    after the document has finished loading
    unless you first call the open method, 
    which clears the current document's window and erases all variables.Note
    When document.write or document.writeln is used in an event handler,
    document.close should also be used.
      

  6.   

    那段代码其实是在页面加载的过程中就执行了的,而执行的当时页面上还没有那个form。
      

  7.   

    laochake(老茶客)已经说得很清楚了,还不明白吗?就是在你在使用document.write的时候,document的内容已经被clear了,你可以查看一下原文件,发现了什么吗,原代码文件就只有aaaa