Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

possible to simulate enter key with javascript?

Status
Not open for further replies.

snobrdinrtiste

Programmer
Aug 22, 2005
24
US
the reason i'm asking this is because I cannot submit the form just yet and need it to be automated...

so is it possible for javascript to emulate the the enter key's keypress event?
 
This is an example of how it can be done.

Once setInterval() has timed out the form data will POST.
Code:
<html>
<head>

<script type="text/javascript">
<!--//
function runTimer() {
    setInterval(autoSubmit(), '100000');
}

function autoSubmit() {
    document.this_form.submit();
}
//-->
</script>

</head>
<body onLoad="runTimer()"

<form method="POST" action="[i]your_script.cgi[/i]" name="this_form">
<input type="text" name="field" value="test">
</form>

</body>
</html>

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top