PDA

View Full Version : Onlick=Enter



Brian_C_C
09-25-2007, 08:44 PM
I'd like to add the "enter" function to this... anyone know how?

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<form><input name='search_term'>&nbsp;&nbsp;&nbsp;&nbsp;<input
type='button' value="Search" onclick=
"javascript:find_text(search_term.value);"></form>

<script type="text/javascript">
function find_text(txt) {
var rng = document.body.createTextRange()
if (rng.findText(txt)) {
rng.select();
}
}
</script><BR>test
</BODY>
</HTML>

Mr Moo
09-26-2007, 12:38 AM
<form><input name='search_term'>&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value="Search" onclick="return find_text(search_term.value);"></form>
<script type="text/javascript">
function find_text(txt) {
var rng = document.body.createTextRange()
if (rng.findText(txt)) {
rng.select();
}
return false;
}
</script>