PDA

View Full Version : TextBox Question??



locbtran
03-30-2010, 12:32 PM
I would like to type something into my textbox and then press ENTER, it will execute a function.

I tried onFocus, onChange and onBlur but it doesn't do what I want it to.

Here's an example I use for onChange.


Application: <input type="text" onchange="execProg(0);">

Any comments or suggestions is greatly

vwphillips
03-30-2010, 01:25 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Enter(obj){
var e=window.event||arguments.callee.caller.arguments[0];
var kc=e.which?e.which:event.keyCode;
if (kc===13){
alert('execute');
}
//execProg(0)
}
/*]]>*/
</script>

</head>

<body>
Application: <input type="text" onkeypress="Enter(this);">
</body>

</html>