GRRRRRR Im starting to hate javascript….
Im trying to make a server status page in javascript that takes if statments from the clock code below.<script type="text/javascript">function startTime(){var today=new Date()var h=today.getHours()var m=today.getMinutes()var s=today.getSeconds()// add a zero in front of numbers<10m=checkTime(m)s=checkTime(s)document.getElementById('txt').innerHTML=h+":"+m+":"+st=setTimeout('startTime()',500)}function checkTime(i){if (i<10) {i="0" + i} return i}</script>Problem is I cant write an IF statment in javascript with this clock, I need to make it so that if time = below 3:00PM that it gives document.write ("server is offline") and if time = 3:00PM-10:00PM that document.write server is online BUT I CANT FigURE it out!!!!IF anyone wants to help me out, please post an example of it and ill put you in the credits of both my website and game. My MMORPG isnt in GM its in visual basic ahhh go figure i can write an MMORPG in VB but cant make a clock do what i want in Javascript……the website is located at www.legendzonline.co.nr
Ok Kool…
I like the dancing sonic lol
My head fell off.
Oh, that's simple to do. Basically, the "h" variable is the current hour in 24 hour time, so you basically just have to go:
if (h > 15 && h < 22){server is online}However, javascript is executed on the local machine, meaning that it will display that the server is online if it is 15:00 for the current person viewing the page. Obviously, that will cause problems if your server is in, say, texas, and the client is in Russia, because the Russian will see that the server is online, while the server in texas sees that it is earlier than 15:00 so the game isn't running.What you want to do instead, is use php. (Judging by your last blog, your host has php instaled)[<]?phpif (date('G') > 15 && date('G') < 22){print "Server is online";}?[>]not in game maker!
koolErm.
What FSX said.That is:Oh, that's simple to do. Basically, the "h" variable is the current hour in 24 hour time, so you basically just have to go:if (h > 15 && h < 22){server is online}However, javascript is executed on the local machine, meaning that it will display that the server is online if it is 15:00 for the current person viewing the page. Obviously, that will cause problems if your server is in, say, texas, and the client is in Russia, because the Russian will see that the server is online, while the server in texas sees that it is earlier than 15:00 so the game isn't running.What you want to do instead, is use php. (Judging by your last blog, your host has php instaled)<?phpif (date('G') > 15 && date('G') < 22){print "Server is online";}?>OMG A SECRET MESSAGE?!
Read closely:<fontsize=3>I don't understand what i'm talking about</font>Drugs make you dance.
And then you pee your pants.