
dlaczego ten kod zamiast czasu pokazuje Error! ?
<html> <head> <style> .displaybox { width:150px; background-color:#ffffff; border:2px solid #000000; padding:10px; font:24px normal verdana, helvetica, arial, sans-serif; } </style> <script language="JavaScript" type="text/javascript"> function getXMLHTTPRequest() { try { req = new XMLHttpRequest(); } catch(err1) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (err2) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (err3) { req = false; } } } return req; } var http = getXMLHTTPRequest(); function getServerTime() { var myurl = 'gettime.php'; myRand = parseInt(Math.random()*999999999999999); var modurl = myurl+"?rand="+myRand; http.open("GET", modurl, true); http.onreadystatechange = useHttpResponse; http.send(null); } function useHttpResponse() { if (http.readyState == 4) { if(http.status == 200) { var timeValue = http.responseXML.getElementsByTagName("timenow")[0]; document.getElementById('showtime').innerHTML = timeValue.childNodes[0].nodeValue; } } else { document.getElementById('showtime').innerHTML = 'Error!'; } } </script> <meta name="generator" content="Namo WebEditor"> <meta name="author" content="OnAjax.net"> </head> <body onLoad="getServerTime();" bgcolor="white"> <center> <form> <input type="button" value="Refresh" onClick="getServerTime()"> </form> <div id="showtime" class="displaybox"> <?php header('Content-Type: text/xml'); echo "<?xml version=\"1.0\" ?><clock1><timenow>\" .date('H:i:s').\"</timenow></clock1></xml>"; ?> </div> </center> </body> </html>