RockinPurdy
Members-
Posts
21 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
RockinPurdy's Achievements
Newbie (1/5)
0
Reputation
-
Is there anyway to use javascript to initialize some php code to accomplish this?
-
Hey, I have a session variable ($_SESSION['variable']) and I have it set to false by default, however I want to be able to set it to true after 10 seconds of the page loading. Is this possible.. if so how?
-
Sorry Im kinda new with Javascript. Could you explain how I would use that?
-
Hey there, I have a script that I've made to countdown to the next 10 minute interval as shown below: function TimeLeft() { var Time = new Date(); var Minutes = Time.getMinutes(); var Seconds = Time.getSeconds(); var MinutesLeft = 0; var SecondsLeft = 0; if (Minutes < 10) { MinutesLeft = 10 - Minutes; } else if (Minutes < 20) { MinutesLeft = 20 - Minutes; } else if (Minutes < 30) { MinutesLeft = 30 - Minutes; } else if (Minutes < 40) { MinutesLeft = 40 - Minutes; } else if (Minutes < 50) { MinutesLeft = 50 - Minutes; } else if (Minutes < 60) { MinutesLeft = 60 - Minutes; } SecondsLeft = 60 - Seconds; if (SecondsLeft < 26) { MinutesLeft = MinutesLeft - 1; SecondsLeft = 60 - (26-SecondsLeft); } else { SecondsLeft = SecondsLeft - 26; } if (SecondsLeft < 10) { SecondsLeft = "0" + SecondsLeft; } document.getElementById('time').innerHTML="Share Value Updates in "+MinutesLeft+":"+SecondsLeft; Timeout = setTimeout('TimeLeft()',500); } The problem is, it freezes when it gets to 1:00... and then when I refresh nothing comes up.. but then when I refresh some more times it will show 10:26 which it shouldn't. Btw, the 26 is an offset.. ie. the countdown was 26 seconds off than what it should have been.
-
Anyone? Still not solved...
-
Not necessarily... It should still be a countdown. Eg. 4 minutes and 12 seconds until the next update (It updates every 10 minutes)
-
Thanks alecks. But the countdown still isn't right It should always be less than 10 minutes... I'll try and reword this. If it is 12:34:21 (twelve thirty-four PM and twenty-one seconds) the countdown should display 5:39 (5 minutes and 39 seconds) Meaning there is 5 minutes and 39 seconds until 12:40... which is to the next 10 minute interval of the current time.
-
Okay, getting there. However the questions kinda confusing, I don't want to round it to the nearest 10 minutes. I want a countdown for every 10 minutes. So like say it's 12:32... I want the countdown to countdown to 12:40.... or if its' 4:35 I want it to countdown to 4:40... Understand?
-
oh no.. I just need to display a countdown to the users. And the reason I don't use that tutorial is because I can't figure out how to do it for every 10 minutes.
-
Really? This countdown doesn't use JS http://www.999tutorials.com/tutorial-show-time-left-with-php.html
-
Hey, I would like to have a countdown on my website that counts down to the nearest 10 minute. Lol confusing. Eg. If it is 4:34:32 (hour,minutes,seconds) the countdown should display 5:28 Eg. If it is 10:39:58 the countdown should display 0:02 - Thanks
-
Try creating a new HTML file with this: <!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"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ShareBux</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <script> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } </script> <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> </head> <body leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onLoad='startClock1()'> <table><tr><td width="400"><img src='images/header.jpg' /></td><td><form name="frm"><input type="text" name="clock" size="3" readonly style="border: none; padding: 0; font-size: 25pt; font-weight: bold; font-family: Verdana; vertical-align:top;"></td><td width='300'> </td></tr></table> <iframe src="http://google.ca" id='frame' frameborder="0" border="1" framspacing="0" marginheight="0" marginwidth="0" scrolling="yes" vspace="0" hspace="0" width="100%"></iframe> <script type="text/javascript"> function resizeIframe() { var height = document.documentElement.clientHeight; height -= document.getElementById('frame').offsetTop; // not sure how to get this dynamically height -= 20; /* whatever you set your body bottom margin/padding to be */ document.getElementById('frame').style.height = height +"px"; }; document.getElementById('frame').onload = resizeIframe; window.onresize = resizeIframe; </script> </body> </html>
-
Uhh.. It's not working in IE7 <script> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } </script> <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> Could it be with: <body leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onLoad='startClock1()'>
-
Yes, GetURLParam is in another part. It works fine in FF, it counts down from 9 and displays it in the textbox But in IE it doesn't even countdown (at least not visible in the textbox; and it never redirects)
-
Hey, the following works in Firefox, but not in Internet Explorer. Why? <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> The "clock" basically doesn't have anything show up in it, and it goes to viewdone.php