var str = document.getElementByNames('USER').value;
str就是你取得的值。

解决方案 »

  1.   

    设置个id
    <input type="text" name="USER" id="USER"> 
    document.getElementById("USER").value不设置id
    document.getElemengtsByTagName("div")[0].getElemengtsByTagName("input")[0].value
      

  2.   

    var str = document.getElementByName('USER').value; 
      

  3.   

    document.getElementByName("USER")[0].value
      

  4.   

    this?<!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>val</title>
    </head><body>
    <div style=\"padding:10px;background-color: #ECE9D8;\" id="dv">
    <input type="text" name="USER">
    <span id="sp"></span>
    </div> 
    </body>
    </html>
    <script>
    var el = document.getElementById("USER");
    el.onpropertychange = function (){
    sp.innerHTML="Value:"+this.value;
    }
    </script>
      

  5.   


    DIV中的子元素可以用children数组来实现。(注意在Firefox需要加一段JS来进行兼容)对于取INPUT里的值,前面几位已经说很多了。说个他们没说过的。document.getElementsByName("USER")因为HTML中不像ID一样限制NAME唯一,所以取出来是个数组。你要用以下方法来取他们的值。document.getElementsByName("USER")[0].value;另外,你还可以给DIV上个ID,用以下的方法来取,得到的也是个数组:document.getElementById("DivId").getElementsByTagName("INPUT")
      

  6.   

    document.getElementByName("USER").value
    最直
      

  7.   

    jquery.js
    在这方面很强的
    alert($("div input[@type=text]").eq(0).val());
      

  8.   

    因该是document.getElementsByName('USER')[0].value;
      

  9.   

    <div id="div1"><input/></div>
    document.getElementById("div1").childNodes[0].value;
    or
    document.getElementById("div1").getElementsByTagName("input")[0].value;