<form action="get.do" method="post" id="fi" name="fn">
username:<input type="text" id="username"/><br/>
password:<input type="password" id="password"/><br/>
<input type="submit" value="submit">
</form>
<form action="get.do" method="post" id="fi" name="fn">
username:<input type="text" id="username"/><br/>
password:<input type="password" id="password"/><br/>
<input type="submit" value="submit">
</form>
可以通过以下三种方式(我所知道的)来取到值:
var show = document.fn.elements['username'].value;//注意这里fn是form的名字,而不是id
var show = document.getElementById('username').value;
var show = fi['username'].value;//fi是form的id号码
var show = document.fn.username.value;//