<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function getFormInformation(){
var myform = document.forms[0];
alert(myform.id+myform.method+myform.target);
myform.submit(); //提交表单
}
</script>
</head>
<body>
<form id="testform" action="http://www.baidu.com" method="get" target="_blank">
<input name="username" type="text" value="请输入密码" /><br />
<input name="pwd" type="password" value="123" /><br />
<select name="city">
<option value="CD">成都</option>
<option value="SH" selected="selected">上海</option>
</select><br />
<input type="button" value="Get number one" οnclick="var n = document.getElementById('testform').elements[0].value;alert(n);"/><br />
<input type="button" value="Get number two" οnclick="alert(document.getElementById('testform').elements['pwd'].value);"/><br />
<input type="button" value="Get number three" οnclick="alert(document.getElementById('testform').city.value);"/><br />
<input type="button" value="Get more information" οnclick="getFormInformation()"/>
</form>
</body>
</html>