<html>
<head>
<script>
window.onload = function(){
}
function check() {
var bt = document.getElementById("bt");
var key = event.keyCode;
if (key == 13)
bt.click();
}
function test() {
var txtValue = document.getElementById("txt").value;
alert(txtValue);
}
</script>
</head>
<body>
<input type="text" id="txt" value="" οnkeypress="return check()" />
<input type="button" id="bt"value="确 定" οnclick="test()">
</body>
</html>
<head>
<script>
window.onload = function(){
}
function check() {
var bt = document.getElementById("bt");
var key = event.keyCode;
if (key == 13)
bt.click();
}
function test() {
var txtValue = document.getElementById("txt").value;
alert(txtValue);
}
</script>
</head>
<body>
<input type="text" id="txt" value="" οnkeypress="return check()" />
<input type="button" id="bt"value="确 定" οnclick="test()">
</body>
</html>