how to solve this setTime out in javascript with an if condition?
<p>here's my script , it's a combined php and javascript</p>

<pre><code>&lt;?php
$countdown = strtotime("22:00") - time();
$itemtime = "22:00";
$realtime = substr(date('H:i'),0,5);
?&gt;

&lt;script&gt;
var itemtime = "$itemtime";
var countdown = '$countdown';
var url = "$redirectpage";
var realtime = "$realtime";

// HOW WILL I ADD AN IF STATEMENT WITH THE SETTIMEOUT FUNCTION
// WHEREBY, if(realtime == itemtime) ..that's the only time the 
// redirection should occur

setTimeout(function(){
 location.href='$redirectpage'; 
    },countdown * 1000);

&lt;/script&gt;
</code></pre>
