
August 19th, 2004, 01:28 AM
|
|
Contributing User
|
|
Join Date: Jul 2004
Posts: 114

Time spent in forums: 18 h 13 m 9 sec
Reputation Power: 5
|
|
Quote: | Originally Posted by Larry770 Hi,
I currently have a form which is submitted via a Javascript using a PHP page. The problem is that the page refreshes after each post/submit. Someone mentioned that this should be done with XML HTTP, but I have no clue on where to begin with this (I have searched online and have not found a good tutorial on how to use it)
Here is the basic idea:
PHP Code:
<HTML>
<HEAD>
<TITLE>webcam controls</TITLE>
<script type="text/javascript">
function register(e) {
if (!e) var e=window.event;
var keyHit=false;
if (e['keyCode']==38) {document.keyForm.direction.value="up";keyHit=true;}
if (keyHit==true) {document.keyForm.submit();keyHit=false;}
}
function init() {
document.onkeydown = register;
}
</script>
</HEAD>
<BODY onload="init();">
<form name="keyForm" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input type="hidden" name="direction" value="null">
</form
<br>
<?php
if (isset($_POST['direction']) && $_POST['direction'] == "upright") {
system("lptout.exe 128");
}
?>
</body>
</html>
In this script the page reloads after every post. As a way out I am toying with using html frames, but if there is a better way, it would make more sense.
Thanks,
Larry |
Aint nothing like talking to yourself... 
|