All pastes #1392514 Raw Edit

Someone

public html v1 · immutable
#1392514 ·published 2009-04-15 06:24 UTC
rendered paste body
<html><head><title>onTime Config Page </title><script language="JavaScript"> function updatepage(){		if(onTimeForm.off.disabled == false)	{		if(!isTime(onTimeForm.alarm.value))		{			alert("Invalid Alarm Data....Enter in XX:XX format");			onTimeForm.alarm.value = "";		}	}		onTimeForm.timezonetxt.value = TimeZone();		onTimeForm.snoozetxt.value = Snooze();		onTimeForm.timetxt24.value = Time();		if((onTimeForm.alarm.value) && (onTimeForm.alarm.disabled == false))		onTimeForm.send.disabled = false;	else		onTimeForm.send.disabled = true;}function isTime(str){	iCol = 0;	c = ":";		if((str.length != 5) || (str[0] > 1) || ((str[0] == 1) && (str[1] > 2)) || (str[3] > 5))		return false;				for (i = 0; i < str.length; i++) 	{		if(str[i] == c)			iCol++;				if(isNaN(str[i]))		{			if((str[i] != c) || (iCol > 1)) 			return false;		}	}		return true;}function TimeZone(){	if((onTimeForm.timezone.selectedIndex == 0) || (onTimeForm.timezone.selectedIndex == 1) || (onTimeForm.timezone.selectedIndex == 2))		return "Pacific Time";			else if((onTimeForm.timezone.selectedIndex == 3) || (onTimeForm.timezone.selectedIndex == 4) || (onTimeForm.timezone.selectedIndex == 5))		return "Mountain Time";		else if((onTimeForm.timezone.selectedIndex == 6) || (onTimeForm.timezone.selectedIndex == 7) || (onTimeForm.timezone.selectedIndex == 8))		return "Central Time";			else if((onTimeForm.timezone.selectedIndex == 9) || (onTimeForm.timezone.selectedIndex == 10) || (onTimeForm.timezone.selectedIndex == 11) || (onTimeForm.timezone.selectedIndex == 12) || (onTimeForm.timezone.selectedIndex == 13) || (onTimeForm.timezone.selectedIndex == 14))		return "Eastern Time";		else if ((onTimeForm.timezone.selectedIndex == 17) || (onTimeForm.timezone.selectedIndex == 18) || (onTimeForm.timezone.selectedIndex == 15) || (onTimeForm.timezone.selectedIndex == 16))		return "Atlantic Time";			else		return "Newfoundland Time";}function Snooze(){	if(onTimeForm.snooze.selectedIndex == 0) 		return "1 minute";		else if(onTimeForm.snooze.selectedIndex == 1) 		return "3 minutes";			else		return "5 minutes";}function Time(){	var iH;	var iM;	var iS;	var str = new String();	var d = new Date();		iH = d.getHours();	iM = d.getMinutes();	iS = d.getSeconds();		if(onTimeForm.timezonetxt.value == "Pacific Time")	{		if(iH == 0)		{			iH = 25;		}				iH -= 1;			}	else if(onTimeForm.timezonetxt.value == "Mountain Time")	{		}	else if(onTimeForm.timezonetxt.value == "Central Time")	{		if(iH == 24)		{			iH = 0;		}		else if(iH == 23)		{			iH = -1;		}				iH += 1;	}	else if(onTimeForm.timezonetxt.value == "Eastern Time")	{			if(iH == 24)		{			iH = 1;		}		else if(iH == 23)		{			iH = 0;		}		else if(iH == 22)		{			iH = -1;		}		else		{			iH += 1		}				iH += 1;	}	else if(onTimeForm.timezonetxt.value == "Atlantic Time")	{		if(iH == 24)		{			iH = 2;		}		else if(iH == 23)		{			iH = 1;		}		else if(iH == 22)		{			iH = 0;		}		else if(iH == 21)		{			iH = -1;		}		else		{			iH += 2;		}				iH += 1;	}	else 	{		if(iH == 24)		{			iH = 2;		}		else if(iH == 23)		{			iH = 1;		}		else if(iH == 22)		{			iH = 0;		}		else if(iH == 21)		{			iH = -1;		}		else		{			iH += 2;		}				if(iM > 30)		{			iM -= 30;		}		else		{			iM += 30;		}				iH += 1;	}			if(iH < 10)		iH = "0" + iH;			if(iM < 10)		iM = "0" + iM;			if(iS < 10)		iS = "0" + iS;		str = iH + ':' + iM + ':' + iS;		if(iH < 11)	{		if(iH == 0)		{			iH = 12;		}				onTimeForm.timetxt.value = iH + ':' + iM + ':' + iS + " AM";		}	else	{		if(iH == 12)		{			iH = 12;		}		else		{			iH -= 12;		}				onTimeForm.timetxt.value = iH + ':' + iM + ':' + iS + " PM";			}		onTimeForm.datetxt.size = d.toLocaleDateString().length - 2;	onTimeForm.datetxt.value = d.toLocaleDateString();			return str;}</script></head><body><FORM NAME="onTimeForm"  action=""  on METHOD="GET"><h1>C<sup>3</sup> Clock</h1> <table width="937"> <tr>  <th width="161" align="left">Current Time</th>  <th width="243" align="center  "><div align="right">    <input type="text" name="timetxt" value="" readonly="readonly" />  </div></th>  <th width="12" align="right"></th>  <th width="189" align="right">Current Time (24 hour)</th>  <th width="252" align="right"><input type="text" name="timetxt24" value="" readonly="readonly" /></th>  <th width="52" align="right"></th> </tr> <tr>  <th width="161" align="left">Date</th>  <th width="243" align="center  "><div align="right">    <input name="datetxt" type="text" value="" readonly="readonly" />  </div></th>  <th width="12" align="right"></th>  <th width="189" align="right">Time Zone</th>  <th width="252" align="right"><input type="text" name="timezonetxt" value="" readonly="readonly" /></th>  <th width="52" align="right"></th> </tr> <tr>  <th align="right"></th>  <th align="right"></th>  <th align="right"></th>  <th align="right">Select Timezone</th>  <th align="right"><select name="timezone"><option value="van">Vancouver</option><option value="vic"> Victoria </option><option value="whi">Whitehorse</option><option value="edm" selected>Edmonton</option><option value="cal">Calgary</option><option value="yel">Yellowknife</option><option value="reg">Regina</option><option value="sas">Saskatoon</option><option value="win">Winnipeg</option><option value="thu">Thunder Bay</option><option value="tor">Toronto</option><option value="ota">Ottawa</option><option value="iqa">Iqaluit</option><option value="mon">Montreal</option><option value="que">Quebec City</option><option value="mnc">Moncton</option><option value="fre">Fredericton</option><option value="cha">Charlottetown</option><option value="hal">Halifax</option><option value="stj">St. John's</option></select></th> <th width="52" align="right"></th> </tr> <tr>  <td></td>  <td></td>  <td></td> </tr> <tr>  <th align="left">Snooze</th>  <th align="right"><input type="text" name="snoozetxt" readonly="readonly" /></th>  <th align="right"></th>  <th align="right">Alarm</th>  <th align="right"><input type="text" name="alarm" id="alarm" disabled="disabled" /></th>  <th width="52" align="right">AM    <input name="rad" type="radio" Value="am" checked ></th> </tr> <tr><th align="left">Options</th>  <th align="right">        <div align="right">          <select name="snooze">            <option value="one" selected>1 Minute</option>            <option value="three"> 3 Minute</option>            <option value="five">5 Minute</option>          </select>        </div></th>  <th align="right"></th>  <th align="right"></th>  <th align="center"><button type="button" name="on" onClick="onTimeForm.on.disabled = true; onTimeForm.off.disabled = false; onTimeForm.alarm.disabled = false;">Alarm ON</button> <button type="button" name="off" disabled="disabled" onClick="onTimeForm.off.disabled = true; onTimeForm.on.disabled = false; onTimeForm.alarm.disabled = true; onTimeForm.send.disabled = true;">Alarm OFF</button></th> <th width="52" align="right">PM   <input type="radio" name="rad" Value="pm" ></th> </tr><th align="left">&nbsp;</th>  <th align="right">&nbsp;</th>  <th align="right"></th>  <th align="right"></th> </tr> <tr>  <th align="right"></th>  <th align="right"><button type="button" name="update" onClick="updatepage()">Update</button></th>  <th align="right"></th>  <th align="right"><button type="submit" disabled="disabled" name="send">Send</button></th>  <th align="right"></th> </tr></table></FORM></body></html>