PDA

View Full Version : "ON AIR" for Radio Station JavaCode



theshock
09-22-2008, 12:36 AM
I have a code that i am using for my radio station website code here it is, but what i want to know is how to make it so it just shows up instead of having to click on it to see who is on air! Here is the code


<style type="text/css">
#NowOn {
border: 0px solid black;
font-size: 14.5px;
color: black;
background: transparent url(Images/on_air_click.png);
height: 212px;
width: 194px;
}
</style>

<script type="text/javascript">



// Sun=0 1 2 3 4 5 Sat=6
var DayOfWeek = new Array('Weekend','Monday','Tuesday','Wednesday','Thursday','Friday','Weekend');

var NoShow = 'No Show Scheduled<br />for The Shock fm';
var DH = new Array (7);
for (d=0; d<7; d++) {
DH[d] = new Array (24);
for (h=0; h<12; h++) { DH[d][h] = ''; }
}

DH[1][5] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][6] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][7] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][8] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][9] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][10] = '<img src="Images/On_air_now%20copy.jpg">';
DH[1][11] = '<img src="Images/theshock.jpg">';
DH[1][12] = '<img src="Images/theshock.jpg">';
DH[1][13] = '<img src="Images/theshock.jpg">';
DH[1][14] = '<img src="Images/theshock.jpg">';
DH[1][15] = '<img src="Images/theshock.jpg">';
DH[1][16] = '<img src="Images/theshock.jpg">';
DH[1][17] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][18] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][19] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][20] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][21] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][22] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[1][23] = '<img src="Images/theshock.jpg">';
DH[1][24] = '<img src="Images/theshock.jpg">';
DH[2][5] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][6] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][7] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][8] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][9] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][10] = '<img src="Images/On_air_now%20copy.jpg">';
DH[2][11] = '<img src="Images/theshock.jpg">';
DH[2][12] = '<img src="Images/theshock.jpg">';
DH[2][13] = '<img src="Images/theshock.jpg">';
DH[2][14] = '<img src="Images/theshock.jpg">';
DH[2][15] = '<img src="Images/theshock.jpg">';
DH[2][16] = '<img src="Images/theshock.jpg">';
DH[2][17] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][18] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][19] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][20] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][21] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][22] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[2][23] = '<img src="Images/theshock.jpg">';
DH[2][24] = '<img src="Images/theshock.jpg">';
DH[3][5] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][6] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][7] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][8] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][9] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][10] = '<img src="Images/On_air_now%20copy.jpg">';
DH[3][11] = '<img src="Images/theshock.jpg">';
DH[3][12] = '<img src="Images/theshock.jpg">';
DH[3][13] = '<img src="Images/theshock.jpg">';
DH[3][14] = '<img src="Images/theshock.jpg">';
DH[3][15] = '<img src="Images/theshock.jpg">';
DH[3][16] = '<img src="Images/theshock.jpg">';
DH[3][17] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][18] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][19] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][20] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][21] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][22] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[3][23] = '<img src="Images/theshock.jpg">';
DH[3][24] = '<img src="Images/theshock.jpg">';
DH[4][5] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][6] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][7] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][8] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][9] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][10] = '<img src="Images/On_air_now%20copy.jpg">';
DH[4][11] = '<img src="Images/theshock.jpg">';
DH[4][12] = '<img src="Images/theshock.jpg">';
DH[4][13] = '<img src="Images/theshock.jpg">';
DH[4][14] = '<img src="Images/theshock.jpg">';
DH[4][15] = '<img src="Images/theshock.jpg">';
DH[4][16] = '<img src="Images/theshock.jpg">';
DH[4][17] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][18] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][19] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][20] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][21] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][22] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[4][23] = '<img src="Images/theshock.jpg">';
DH[4][24] = '<img src="Images/theshock.jpg">';
DH[5][5] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][6] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][7] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][8] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][9] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][10] = '<img src="Images/On_air_now%20copy.jpg">';
DH[5][11] = '<img src="Images/theshock.jpg">';
DH[5][12] = '<img src="Images/theshock.jpg">';
DH[5][13] = '<img src="Images/theshock.jpg">';
DH[5][14] = '<img src="Images/theshock.jpg">';
DH[5][15] = '<img src="Images/theshock.jpg">';
DH[5][16] = '<img src="Images/theshock.jpg">';
DH[5][17] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][18] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][19] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][20] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][21] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][22] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[5][23] = '<img src="Images/theshock.jpg">';
DH[5][24] = '<img src="Images/theshock.jpg">';
DH[6][7] = '<img src="Images/theshock.jpg">';
DH[6][8] = '<img src="Images/theshock.jpg">';
DH[6][9] = '<img src="Images/theshock.jpg">';
DH[6][10] = '<img src="Images/theshock.jpg">';
DH[6][11] = '<img src="Images/theshock.jpg">';
DH[6][12] = '<img src="Images/theshock.jpg">';
DH[6][13] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[6][14] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[6][15] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[6][16] = '<img src="Images/alexander_on_air%20copy.jpg">';
DH[6][17] = '<img src="Images/theshock.jpg">';
DH[6][18] = '<img src="Images/theshock.jpg">';
DH[6][19] = '<img src="Images/theshock.jpg">';
DH[6][20] = '<img src="Images/theshock.jpg">';
DH[6][21] = '<img src="Images/theshock.jpg">';
DH[6][22] = '<img src="Images/theshock.jpg">';
DH[6][23] = '<img src="Images/theshock.jpg">';
DH[6][24] = '<img src="Images/theshock.jpg">';
DH[0][10] = '<img src="Images/theshock.jpg">';
DH[0][11] = '<img src="Images/theshock.jpg">';
DH[0][12] = '<img src="Images/theshock.jpg">';
DH[0][13] = '<img src="Images/theshock.jpg">';
DH[0][14] = '<img src="Images/theshock.jpg">';
DH[0][15] = '<img src="Images/theshock.jpg">';
DH[0][16] = '<img src="Images/theshock.jpg">';
DH[0][17] = '<img src="Images/theshock.jpg">';
DH[0][18] = '<img src="Images/theshock.jpg">';
DH[0][19] = '<img src="Images/theshock.jpg">';
DH[0][20] = '<img src="Images/theshock.jpg">';
DH[0][21] = '<img src="Images/theshock.jpg">';
DH[0][22] = '<img src="Images/theshock.jpg">';
DH[0][23] = '<img src="Images/theshock.jpg">';
DH[0][24] = '<img src="Images/theshock.jpg">';
// Add more when schedule is known. Note: there may be better ways to do this when information is known.


function OnNow() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
// alert(dayofweek+':'+hourofday+'<br />'+DH[dayofweek][hourofday]);
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'\n\nNo Show Scheduled'; }

}

function NowON() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'<p />No Show Scheduled'; }
}
</script>
<title></title></head>
<body>
<script type="text/javascript">
</script>
<div id='NowOn' onClick="NowON()"></div>

</html>


If Any one knows how please tell or e-mail me at theshockfm@gmail.com... Thanks:)

schorhr
09-22-2008, 06:19 AM
you could use <body onload="NowON()"> or simply place it inside a <script....></script...> tag.

magicyte
09-27-2008, 01:55 AM
Yes. There are three ways I know of doing this.

1) place onload="NowON()" in body tag

2) place the following, NowON();, in between the script tag

3) place document.onload = NowON(); in between the script tag

-magicyte

TheJoshMan
09-27-2008, 03:18 AM
btw... this isn't "java"

magicyte
09-27-2008, 03:23 AM
Very true. This is not Java. 'Tis JavaScript.

Remeber that! It can become very helpful...

-magicyte