php & javascript problem
| From: | Denis L. Menezes | Date: | Sun, 23 Mar 2003 09:22:16 +0000 |
| Subject: | php & javascript problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140746@lists.php.net to get a copy of this message | ||
Hello friends.
I need to control the users viewing from one location so that when I change the URL string in a text
file, the viewers page which has a timer automatically reads the URL on the text pages and goes to
that page.
Updating the textfile is ok. But below is the script onthe page which I want to reload every 10
seconds and display the name of the new page and go there.
There are two problems, when the page reloads, the PHP script that gets the new URL from the text
file does not seem to run.
Can someone please tell me where I am wrong?
Thanks very much.
Denis
<?php
$fo=fopen("currenttext.txt","r+");
$currenturl=fgets($fo,128);
$currenturl="\"".$currenturl."\"";
Print $currenturl;
Print"<form name=\"frmurl\">";
Print"<input type=\"hidden\" name=\"currenturl\" size=\"4\"
value=$currenturl >";
Print "<input type=\"text\" name=\"clock\"
size=\"4\">";
Print"<form>";
fclose($fo);
?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!--
var x = 10
var y = 1
var url= document.frmurl.currenturl.value;
function startClock(){
x = x-y
document.frmurl.clock.value = x
setTimeout("startClock()", 1000)
if(x==0){
location=url
//window.location.reload()
//document.frmurl.clock.value = 10
//x=10;
}
}
//-->
</script>