<html><head><script>
function getValue()
{
var tt=document.getElementsByName("select1"); 
alert (tt[0].getAttribute("value"));
}
</script></head>
<body>
<form name="form1">
     <select name="select1" onChange="getValue()">
          <option value="1">1</option>
          <option value="2">2</option>
     </select>
</form>
</body></html>

解决方案 »

  1.   

    L@_@K<html><head><script>
    function getValue()
    {
    var tt=document.getElementsByName("select1"); 
    alert("length: " + tt.length);
    alert("value: " + tt[0].value);
    }
    </script></head>
    <body>
    <form name="form1">
         <select name="select1" onChange="getValue()">
              <option value="1">1</option>
              <option value="2">2</option>
         </select>
    </form>
    </body></html>
      

  2.   

    <html><head><script>
    function getValue()
    {
    var tt=document.getElementById("select1").value; 
    alert (tt);
    }
    </script></head>
    <body>
    <form name="form1">
         <select name="select1" onChange="getValue()">
              <option value="1">1</option>
              <option value="2">2</option>
         </select>
    </form>
    </body></html>
      

  3.   

    1、“pro_class1”这个名称没有
    2、“getElementsByName”得到的是个数组,name允许重名。
    <html><head><script>
    function getValue()
    {
    var tt=document.getElementsByName("select1")[0].value; 
    alert (tt);
    }
    </script></head>
    <body>
    <form name="form1">
         <select name="select1" onChange="getValue()">
              <option value="1">1</option>
              <option value="2">2</option>
         </select>
    </form>
    </body></html>