Potrebuju v presne dany cas vypsat JavaScriptem text a otevrit novou stranku. Skript tedy pobezi tak dlouho, nez nastane dany cas.
Zkousel jsem:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta http-equiv="content-language" content="cs" />
<meta name="language" content="cs" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>:-)</title>
</head>
<body>
<script type="text/javascript">
var now = new Date();
var hour = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var i = 0;
//dany cas:
var hodiny = 13;
var minuty = 19;
var sekundy = 30;
while (i = 0) {
if(hour == hodiny && minutes == minuty && seconds == sekundy) {
document.getElementById("abc").innerHTML="TED<br>";
document.getElementById("abc").innerHTML=":-)";
window.open("http://www.google.cz",'_blank');
i = 1;
}
sleep(500);
delete now;
var now = new Date();
var hour = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
}
</script>
<p id="abc" style="font-size: 150%;"></p>
</body>
</html>
ale porad to nefunguje, nevite, kde delam chybu?