Ads Posted January 1, 2008 Share Posted January 1, 2008 i have a Table and inside the Table in one Row, is text and the Other one is an Iframe. main.php <TABLE height="100%" width="100%" CELLSPACING="0" CELLPADDING="0" border=1> <tr> <td> Some text is here Some Links Which Link to the iframe. </td> <td> <iframe name="mainbody" src="quaters.php" width="770" height="561" frameborder=0></iframe> </td> </tr> </table> And before all that i have a PHP include putting in a header File Containing the Time. header.php <center> <table width="200"> <tr> <td> <strong> <?php include("include/db.php"); echo "<marquee>"; $date=date("H:i"); $Sdate=date("H"); $Sdate1=date("i"); $Sdate1=$Sdate1-10; $sdate=$Sdate.$Sdate1; echo $date; echo "</marquee>"; $last_active=mysql_query("UPDATE players SET last_active='$date' WHERE id='$PID'"); ?> </td> </tr> </table> </center> Now what i want it to do, is whenever a link is Pressed Either in the Main Body or in the Iframe i want the header.php to Reload and update the Time. Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/ Share on other sites More sharing options...
MikeDXUNL Posted January 1, 2008 Share Posted January 1, 2008 updatetime.js ------------------------- var xmlHttp function updateTime(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="incl/header.php"; url=url+"?click="+str; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("updateTime").innerHTML=xmlHttp.responseText; } } header.php ---------------------- <?php if(isset($_GET['click']) { if($_GET['click'] == "yes") { echo "<marquee>"; $date=date("H:i"); $Sdate=date("H"); $Sdate1=date("i"); $Sdate1=$Sdate1-10; $sdate=$Sdate.$Sdate1; echo $date; echo "</marquee>"; } } ?> main.php ------------------------------------ <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Untitled</title> <script type="text/javascript" src="updatetime.js"></script> </head> <body> <div id="updateTime"></div> <TABLE height="100%" width="100%" CELLSPACING="0" CELLPADDING="0" border=1> <tr> <td> <a href="link.php" onClick="updateTime('yes')" target="mainbody">Link IFRAME</a> <a href="link.php" onClick="updateTime('yes')">Link No Frame</a> </td> <td> <iframe name="mainbody" src="quaters.php" width="770" height="561" frameborder=0></iframe> </td> </tr> </table> </body> </html> i am going to test this now. but this should be right.. Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427154 Share on other sites More sharing options...
Ads Posted January 1, 2008 Author Share Posted January 1, 2008 Is there anyway to do this with out Putting The java script Code on every link. Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427155 Share on other sites More sharing options...
Ads Posted January 2, 2008 Author Share Posted January 2, 2008 BUMP, Sorry To Bump I sorta need this Semi-Urgetly Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427766 Share on other sites More sharing options...
teng84 Posted January 2, 2008 Share Posted January 2, 2008 Is there anyway to do this with out Putting The java script Code on every link. maybe yes can you explain this ! Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427775 Share on other sites More sharing options...
Ads Posted January 2, 2008 Author Share Posted January 2, 2008 <a href="link.php" onClick="updateTime('yes')" target="mainbody">Link IFRAME</a> <a href="link.php" onClick="updateTime('yes')">Link No Frame</a> See with every single Link i will need that onclick (sorry not Javscript ) So is there a way to do it without Having to have the onclick on every single Link? Quote Link to comment https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427785 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.