- Code: Select all
<html>
<head>
<SCRIPT type="text/javascript"> <!-- archaic form: LANGUAGE="JavaScript" -->
<!-- Original: Emanuel Gavrilv (eltal@sprint.ca) -->
<!-- Web Site: http://www.angelfire.com/on/eltal -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
// From: http://www.webdeveloper.com/forum/showthread.php?t=235734
function IfZero(num) { return ((num <= 9) ? ("0" + num) : num); }
function check24(hour) { return (hour >= 24) ? hour - 24 : hour; }
function StatusDescription(HHMM) {
var msg = "Market is Closed";
if ((HHMM >= '09:30') && (HHMM < '09:50'))
{ msg = "Opening Bell";}
if ((HHMM >= '09:50') && (HHMM < '10:10'))
{ msg = "The Morning Reversal"; }
if ((HHMM >= '10:10') && (HHMM < '10:25')) { msg = "Low Risk Trading"; }
if ((HHMM >= '10:25') && (HHMM < '10:30')) { msg = "Decision Time"; }
if ((HHMM >= '10:30') && (HHMM < '11:15')) { msg = "Final Move of the Morning"; }
if ((HHMM >= '11:15') && (HHMM < '14:15')) { msg = "Go Eat Your Lunch!!";}
if ((HHMM >= '14:15') && (HHMM < '15:00')) { msg = "Back to Business"; }
if ((HHMM >= '15:00') && (HHMM < '15:10')) { msg = "It's GO Time"; }
if ((HHMM >= '15:10') && (HHMM < '15:25')) { msg = "Use Caution & Stay with the Trend"; }
if ((HHMM >= '15:30') && (HHMM < '14:00')) { msg = "Portfolio Re-balancing"; }
if((HHMM >= '15:31' ) && (HHMM <= '15:59')) {msg = "Market is Closed(18 hours)";}
if((HHMM >= '16:00' ) && (HHMM <= '16:59')) {msg = "Market is Closed(17 hours)";}
if((HHMM >= '17:00' ) && (HHMM <= '17:59')) {msg = "Market is Closed(16 hours)";}
if((HHMM >= '18:00' ) && (HHMM <= '18:59')) {msg = "Market is Closed(15 hours)";}
if((HHMM >= '19:00' ) && (HHMM <= '19:59')) {msg = "Market is Closed(14 hours)";}
if((HHMM >= '20:00' ) && (HHMM <= '20:59')) {msg = "Market is Closed(13 hours)";}
if((HHMM >= '21:00' ) && (HHMM <= '21:59')) {msg = "Market is Closed(12 hours)";}
if((HHMM >= '22:00' ) && (HHMM <= '22:59')) {msg = "Market is Closed(11 hours)";}
if((HHMM >= '23:00' ) && (HHMM <= '23:59')) {msg = "Market is Closed(10 hours)";}
if((HHMM >= '00:00' ) && (HHMM <= '00:59')) {msg = "Market is Closed(9 hours)";}
if((HHMM >= '01:00' ) && (HHMM <= '01:59')) {msg = "Market is Closed(8 hours)";}
if((HHMM >= '02:00' ) && (HHMM <= '02:59')) {msg = "Market is Closed(7 hours)";}
if((HHMM >= '03:00' ) && (HHMM <= '03:59')) {msg = "Market is Closed(6 hours)";}
if((HHMM >= '04:00' ) && (HHMM <= '04:59')) {msg = "Market is Closed(5 hours)";}
if((HHMM >= '05:00' ) && (HHMM <= '05:59')) {msg = "Market is Closed(4 hours)";}
if((HHMM >= '06:00' ) && (HHMM <= '06:59')) {msg = "Market is Closed(3 hours)";}
if((HHMM >= '07:00' ) && (HHMM <= '07:59')) {msg = "Market is Closed(2 hours)";}
if((HHMM >= '08:00' ) && (HHMM <= '08:59')) {msg = "Market is Closed(1 hours)";}
return msg;
}
function $_(IDS) { return document.getElementById(IDS); }
function GetTime() {
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
document.clock.local.value = (IfZero(dt.getHours())
+ ":" + IfZero(dt.getMinutes())
+ ":" + IfZero(dt.getSeconds()));
var ending = ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds());
var tmp = [];
for (var i=0; i<24; i++) {
tmp[i] = IfZero(check24(((gmt+i) > 24)?((gmt+i) - 24) :(gmt+i)))+ending;
}
document.clock._GMT.value = tmp[1]; $_('text0').value = StatusDescription(tmp[0]);
// document.clock.rome.value = tmp[1]; $_('text1').value = StatusDescription(tmp[1]);
// document.clock.Israel.value = tmp[2]; $_('text2').value = StatusDescription(tmp[2]);
// document.clock.msw.value = tmp[3]; $_('text3').value = StatusDescription(tmp[3]);
// document.clock.baku.value = tmp[4]; $_('text4').value = StatusDescription(tmp[4]);
// document.clock.del.value = tmp[5]; $_('text5').value = StatusDescription(tmp[5]);
// document.clock.dh.value = tmp[6]; $_('text6').value = StatusDescription(tmp[6]);
// document.clock.kok.value = tmp[7]; $_('text7').value = StatusDescription(tmp[7]);
// document.clock.ho.value = tmp[8]; $_('text8').value = StatusDescription(tmp[8]);
document.clock.tky.value = tmp[9]; $_('text9').value = StatusDescription(tmp[9]);
document.clock.sdn.value = tmp[10]; $_('text10').value = StatusDescription(tmp[10]);
document.clock.nyk.value = tmp[20]; $_('text11').value = StatusDescription(tmp[20]);
// document.clock.mag.value = tmp[11]; $_('text11').value = StatusDescription(tmp[11]);
// document.clock.wll.value = tmp[12]; $_('text12').value = StatusDescription(tmp[12]);
//document.clock.sam.value = tmp[13]; $_('text13').value = StatusDescription(tmp[13]);
// document.clock.Hawaii.value = tmp[14]; $_('text14').value = StatusDescription(tmp[14]);
// document.clock.alaska.value = tmp[15]; $_('text15').value = StatusDescription(tmp[15]);
// document.clock.pacif.value = tmp[16]; $_('text16').value = StatusDescription(tmp[16]);
// document.clock.mount.value = tmp[17]; $_('text17').value = StatusDescription(tmp[17]);
// document.clock.center.value = tmp[18]; $_('text18').value = StatusDescription(tmp[18]);
// document.clock.east.value = tmp[19]; $_('text19').value = StatusDescription(tmp[19]);
// document.clock.atl.value = tmp[20]; $_('text20').value = StatusDescription(tmp[20]);
// document.clock.bra.value = tmp[21]; $_('text21').value = StatusDescription(tmp[21]);
// document.clock.mid.value = tmp[22]; $_('text22').value = StatusDescription(tmp[22]);
// document.clock.azo.value = tmp[23]; $_('text23').value = StatusDescription(tmp[23]);
//function changeBGC(color)
// {
//document.bgColor = color;
//}
//document.clock.leb.value = tmp[3];
//document.clock.text1.value = StatusDescription(tmp[3]);
//document.clock.eniw.value = tmp[12];
// document.clock.text24.value = StatusDescription(tmp[12]);
setTimeout("GetTime()", 1000);
}
</script>
</head>
<BODY onLoad="javascript:GetTime();">
<center>
<form name="clock">
<strong>Local Time <input type="text" size="8" name="local" ></strong>
<br>
<p>
<table border="0">
<!--
<td> Eniwetok (GMT-12) </td>
<td> <input type="text" size="8" name="eniw"> </td>
<td> Status: <INPUT id="text24" type="text" size="25"> </td>
-->
<!--
<td> Samoa (GMT-11) </td>
<td> <input type="text" size="8" name="sam"> </td>
<td> Status: <INPUT id="text13" type="text" size="25"> </td>
</tr>
<tr>
<td> Hawaii (GMT-10) </td>
<td> <input type="text" size="8" name="Hawaii"> </td>
<td> Status: <INPUT id="text14" type="text" size="25"> </td>
</tr>
<tr>
<td> Alaska (GMT-9) </td>
<td> <input type="text" size="8" name="alaska"> </td>
<td> Status: <INPUT id="text15" type="text" size="25"> </td>
</tr>
<tr>
<td> Pacific Time (GMT-8) </td>
<td> <input type="text" size="8" name="pacif"> </td>
<td> Status: <INPUT id="text16" type="text" size="25"> </td>
</tr>
<tr>
<td> Mountain Time (GMT-7) </td>
<td> <input type="text" size="8" name="mount"> </td>
<td> Status: <INPUT id="text17" type="text" size="25"> </td>
</tr>
<tr>
<td> Central Time (GMT-6) </td>
<td> <input type="text" size="8" name="center"> </td>
<td> Status: <INPUT id="text18" type="text" size="25"> </td>
</tr>
<tr>
<td> Eastern Time (GMT-5) </td>
<td> <input type="text" size="8" name="east"> </td>
<td> Status: <INPUT id="text19" type="text" size="25"> </td>
</tr>
<tr>
<td> Atlantic Time (GMT-4) </td>
<td> <input type="text" size="8" name="atl"> </td>
<td> Status: <INPUT id="text20" type="text" size="25"> </td>
</tr>
<tr>
<td> Brazilia (GMT-3) </td>
<td> <input type="text" size="8" name="bra"> </td>
<td> Status: <INPUT id="text21" type="text" size="25"> </td>
</tr>
<tr>
<td> Mid-Atlantic (GMT-2) </td>
<td> <input type="text" size="8" name="mid"> </td>
<td> Status: <INPUT id="text22" type="text" size="25"> </td>
</tr>
<tr>
<td> Azores (GMT-1) </td>
<td> <input type="text" size="8" name="azo"> </td>
<td> Status: <INPUT id="text23" type="text" size="25"> </td>
</tr>
-->
<tr>
<td> London (GMT) </td>
<td> <input type="text" size="8" name="_GMT"> </td>
<td> Status: <INPUT id="text0" type="text" size="25"STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;" >
</tr>
<!--
<tr>
<td> Rome (GMT +1) </td>
<td> <input type="text" size="8" name="rome"> </td>
<td> Status: <INPUT id="text1" type="text" size="25"> </td>
</tr>
<tr>
<td> Israel (GMT +2) </td>
<td> <input type="text" size="8" name="Israel"> </td>
<td> Status: <INPUT id="text2" type="text" size="25"> </td>
</tr>
<tr>
<td> Moscow (GMT +3) </td>
<td> <input type="text" size="8" name="msw"> </td>
<td> Status: <INPUT id="text3" type="text" size="25"> </td>
</tr>
<tr>
<td> Baku (GMT +4) </td>
<td> <input type="text" size="8" name="baku"> </td>
<td> Status: <INPUT id="text4" type="text" size="25"> </td>
</tr>
<tr>
<td> New Delhi (GMT +5) </td>
<td> <input type="text" size="8" name="del"> </td>
<td> Status: <INPUT id="text5" type="text" size="25"> </td>
</tr>
<tr>
<td> Dhakar (GMT +6) </td>
<td> <input type="text" size="8" name="dh"> </td>
<td> Status: <INPUT id="text6" type="text" size="25"> </td>
</tr>
<tr>
<td> Bangkok (GMT +7) </td>
<td> <input type="text" size="8" name="kok"> </td>
<td> Status: <INPUT id="text7" type="text" size="25"> </td>
</tr>
<tr>
<td> Hong Kong (GMT +8) </td>
<td> <input type="text" size="8" name="ho"> </td>
<td> Status: <INPUT id="text8" type="text" size="25"> </td>
</tr>
-->
<tr>
<td> Tokyo (GMT +9) </td>
<td> <input type="text" size="8" name="tky"> </td>
<td> Status: <INPUT id="text9" type="text" size="25"STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: red;" >
</tr>
<tr>
<td> Sydney (GMT +10) </td>
<td> <input type="text" size="8" name="sdn"> </td>
<td> Status: <INPUT id="text10" type="text" size="25"STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: red;" >
</tr>
<tr>
<td> New York (GMT -7) </td>
<td> <input type="text" size="8" name="nyk"> </td>
<td> Status: <INPUT id="text11" type="text" size="25"STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: blue;" >
</tr>
<!--
<tr>
<td> Magadan (GMT +11) </td>
<td> <input type="text" size="8" name="mag"> </td>
<td> Status: <INPUT id="text11" type="text" size="25"> </td>
</tr>
<tr>
<td> Wellington (GMT +12) </td>
<td> <input type="text" size="8" name="wll"> </td>
<td> Status: <INPUT id="text12" type="text" size="25"> </td>
</tr>
-->
</form>
</center>
<noscript>
Your browser either does not support JavaScript, or you have JavaScript turned off.
</noscript>
</body>
</html>
What I basically want is that when the market is closed for the correseponding time the color of the input becomes red otherwise it becomes blue! can anyone help me with this issue please! thanks a lot!




