下面给出的代码不起作用。
<html>
<head>
<script type="text/javascript">
function dosomething(ID){
var name = document.getElementById(ID).value;
alert(name);
}
</script>
</head>
<body>
<input type="text" id="name1" /><input type="button" value="click" onclick="dosomething("name1")" />
<br /><br />
<input type="text" id="name2" /><input type="button" value="click" onclick="dosomething("name2")" />
</body>
</html>