View Full Version : "on air" script

05-05-2012, 12:54 PM
hello everyone,
i have code for my internet-radio site "on air".
that is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Station Activity</title>

<style type="text/css">
td { font-size:0.6em; } /* temporary for testing purposes */
#NowOn {
border: 0px solid black;
font-size: 11.5px;
color: black;
background: transparent;
height: 55px;
width: 350px;

<script type="text/javascript">

var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();

var GMT = new Date().getTimezoneOffset();
var offsetGMT = -5 * new Date().getTimezoneOffset()/60;

// 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 KSWH';
var DH = new Array (7);
for (d=0; d<7; d++) {
DH[d] = new Array (24);
for (h=0; h<24; h++) { DH[d][h] = ''; }

DH[1][10] = 'Monday at 10 AM<br>Modern Rock<br>with Cody Graves';
DH[1][12] = 'No Show Name<br>with DJ JT<br>Monday at Noon<br>No Genre';
DH[1][14] = 'Real Talk<br>with DJ Yella<br>Monday at 2 PM<br>No Genre';
DH[1][16] = 'No Show Name<br>with Katy Cox<br>Monday at 4 PM<br>Rap';
DH[1][17] = 'The Greatest<br>with DJ Fresh<br>Monday at 5 PM<br>No Genre';
DH[1][18] = 'Revolution Corner<br>with Randy Underwood<br>Monday at 6 PM<br>No Genre';
DH[1][20] = 'Daily Affirmation<br>with DJ Hightower<br>Monday at 8 PM<br>No Genre';
DH[1][22] = 'No Show Name<br>with David Doggett<br>Monday 10 to Midnight<br>No Genre';
DH[1][23] = 'No Show Name<br>with David Doggett<br>Monday at 11 PM<br>No Genre';
DH[2][13] = 'No Show Name<br>with Michelle Caillouet<br>Tuesday at 1 PM<br>Rock';
DH[2][16] = 'No Show Name<br>with Sweet Action Jackson<br>Tuesday at 4 PM<br>Rock';
DH[2][20] = 'The Rock Hour<br>with Dan the Man<br>Tuesday at 8 PM<br>No Genre';
DH[3][10] = 'Love Me! Hate Me!<br>with DJ Nia<br>Wednesday at 10 AM<br>No Genre';
DH[3][11] = 'Westcoast Wednesdays<br>with DJ Smoove<br>Wednesday at 11 AM<br>No Genre';
DH[3][15] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday 3 to 5 PM<br>Classic Rock';
DH[3][16] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday at 4 PM<br>Classic Rock';
DH[3][22] = 'EZ Does It<br>with DJ EZ<br>Wednesday at 10 PM<br>Rap';
DH[4][12] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday Noon to 2 PM<br>Rap/Urban';
DH[4][13] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday at 1 PM<br>Rap/Urban';
DH[4][14] = 'The Hour<br>with DJ V-Jeezy<br>Thursday at 2 PM<br>No Genre';
DH[4][15] = 'No Show Name<br>with DJ Savana<br>Thursday at 3 PM<br>No Genre';
DH[5][10] = 'Friday at 10 AM<br>Christian Music<br>with Jammin J';
DH[5][11] = 'Friday at 11 AM<br>Christian Music<br>with Jammin J';
DH[5][12] = 'Friday at Noon<br>Modern Rock<br>with Tag and Em';
DH[5][13] = 'Friday at 1 PM<br>Modern Rock<br>with Tag and Em';
DH[5][14] = 'Friday at 2 PM<br>Urban Music<br>with Brandon Tabor';
DH[5][15] = 'Friday at 3 PM<br>Unknown Genre<br>with DJ Kevin';
DH[5][16] = 'Friday at 4 PM<br>Urban Music<br>with Big Hampton';
DH[5][17] = 'Friday at 5 PM<br>Urban Music<br>with Big Hampton';
DH[5][22] = 'Friday at 10 PM<br>Modern Rock<br>with DJ Werewolf';
DH[5][23] = 'Friday at 11 PM<br>Modern Rock<br>with DJ Werewolf';
// 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'; }
document.getElementById('NowOn').innerHTML = showOn;
<BODY onLoad="NowON()">
<!-- Unhide this if table display desired
<script type="text/javascript">
<script type="text/javascript">
<div id='NowOn' onClick="NowON()">Click For Now On KSWH</div>
now my question is:
1. how do i make it update automatically?
2. how do i make it by hours and minutes (ex: Dj Ben 08:00 - 08:23 and not Dj Ben 8:00 - 9:00)
thanks very very much i really appreciate it!
if you can share that with your friends it will be very helpful!!!
good day everyone!!!

05-06-2012, 03:58 PM
no one can help me? really i need this help please!!! :):confused:

05-07-2012, 03:15 PM
anyone?! i must this help!!!!!!! help me in this script!!! thanks.... :\

05-08-2012, 04:44 PM
i must this help!!!! MuSt!!!!!

05-11-2012, 03:52 PM
still no one answer me?

05-11-2012, 11:30 PM
Have a look at the options for Cronjobs on your server. For our radio site we've taken the data straight from Shoutcast. You can set the DJ, Show, currently playing song, up next, next DJ and all sorts, then so long as Shoutcast is On Air, it'll update automatically. We're using Joomla 2.5 for our site and we've tried a range of non-commercial plugins. There's too many to go through here though. If you use Joomla, check out the extensions directory. If you don't use Joomla, have a look into it and you can even download the extensions to see how they handle the JavaScripting and such.

05-12-2012, 05:06 AM
no, i use html on my local server. my site still not in the internet, we down it. so someone have another idea?

05-12-2012, 10:27 AM
What are you using to broadcast your radio? Shoutcast? Icecast?

05-12-2012, 11:10 AM
Wme media encoder. why?

05-12-2012, 11:53 AM
Try Shoutcast. It will automate a lot of what you want to do. It's easy to set up and easy to use. And it's a lot more listener friendly. It works on RealPlayer, VLC, Media Player, Online (through browser), Smartphone and a few others.

05-12-2012, 12:44 PM
i need to know how to use this not Shoutcast cuz i know how to use wme but thanks for the tip

05-12-2012, 01:19 PM
This is what I'm saying. Using Shoutcast will alleviate the need to solve this problem. I am giving you a very simple and user friendly solution to your problem. You're here to learn how to fix your site, so learn an industry recognised tool that will vastly help you.

I'm a WebDev for an internet radio site so I know what I'm talking about here.

05-12-2012, 01:32 PM
okay, but i need help also in js. i will try your tip about shoutcast (even its not free), but if you can help me also in the js, i will appriciate it.

** sorry for my poor english **

05-12-2012, 01:42 PM
Shoutcast is free.


05-13-2012, 03:18 PM
i will try.

05-04-2015, 07:05 AM
i know this is probably an old post but is there a link
for the shoutcast scripts like the on air php script at all?

05-04-2015, 09:31 AM
I know nothing about shoutcast but it appears to be an audio streaming service rather than a downloadable script.

And what php script are you referring to? The original post is for a script alteration to a timing function in JavaScript.

I think it would be easier for folks to offer suggestions if you describe what it is you are looking for, fully and in your own words.