<script>
function fn_get(){
var e1 = document.getElementById("one");
alert(e1.nextSibling.value);
}
</script>
<input type="text" id="one" name="" value=""></input>
<input type="text" id="two" name="" value="sdfsdf"></input>
<input type="button" id="btn" value="  ok  " onclick="fn_get()" />

解决方案 »

  1.   

    L@_@K
    <!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>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <script>
    function fn_get(){
        var e1 = document.getElementById("one");
    while (e1.nextSibling)
    {
    if (e1.nextSibling.nodeType == 1 && e1.nextSibling.tagName.toLowerCase() == "input")
    {
    alert(e1.nextSibling.value);
    break;
    }
    else
    e1 = e1.nextSibling;
    }
    }
        </script><input type="text" id="one" name="" value=""></input>
    <input type="text" id="two" name="" value="sdfsdf"></input>
    <input type="button" id="btn" value="  ok  " onclick="fn_get()" /> </body>
    </html>
      

  2.   


    <script>
    function fn_get(){
        var e1 = document.getElementById("one");
    var op = e1.nextSibling;
    while(op.nodeType != 1){
    op = op.nextSibling
    }
        alert(op.value);
    }
        </script>
    <input type="text" id="one" name="" value=""/>
    <input type="text" id="two" name="" value="sdfsdf"/>
    <input type="button" id="btn" value="  ok  " onclick="fn_get()" />