IEの中のform元素の中のnameはidと同じです.

1101 ワード

<script type="text/javascript">

     function testIECase(name){
        alert(document.getElementById(name).value);
    }

</script>
<hr />
 ie        txtName   ,name="txtName"      
<button onclick="testIECase('txtName')">test txtName</button>
<hr />
 ie        txtPassword   ,id="txtPassword"      

<button onclick="testIECase('txtPassword')">test txtPassword</button>
<hr />
<input name="txtName" value="txtName 1"/>

<input id="txtName"  value="txtName 2"/>

<input id="txtPassword"  value="txtPassword 1"/>

<input name="txtPassword"  value="txtPassword 2"/>


<hr />
<br />
<code>
function testIECase(name){
        alert(document.getElementById(name).value);
    }
</code>