NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Javascript help needed

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Reply
 
LinkBack Thread Tools
Old 03-13-2009, 02:39 PM THREAD STARTER               #1 (permalink)
Senior Member
 
Joseph's Avatar
Join Date: Dec 2004
Location: Ireland
Posts: 2,684
Joseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond reputeJoseph has a reputation beyond repute
 


Animal Cruelty 9/11/01 :: Never Forget Find Marrow Donors! Save The Children Save The Children Save The Children Ethan Allen Fund Baby Health Child Abuse Cancer AIDS/HIV Autism Autism Lou Gehrig's Disease (ALS) Parkinson's Disease Alzheimer's Cancer Save a Life Cancer Cancer Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009

Javascript help needed


Hey guys,

I'm setting up an online radio station at the minute and I've been looking at ways to display the schedule. I've stumbled upon this code:

Quote:
<!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">
<head>
<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;
}
</style>

<script type="text/javascript">

/* NOT CURRENTLY USED
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','Th ursday','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][18] = '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'; }
alert(showOn);
}
????: NamePros.com http://www.namepros.com/programming/566856-javascript-help-needed.html

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;
}
</script>
</head>
<BODY onLoad="NowON()">
<!-- Unhide this if table display desired
<script type="text/javascript">
document.write(TableStationSchedule())
</script>
-->
<script type="text/javascript">
document.write(NowON());
</script>
<div id='NowOn' onClick="NowON()">Click For Now On KSWH</div>
</body>
</html
What I need for it to do is also display on the page the whole schedule for that day. For example, if its Monday it will display

PHP Code:
Monday at 10 AM</span>>Modern Rock</span>>with Cody Graves No Show Name</span>>with DJ JT</span>>Monday at Noon</span>>No Genre Real Talk</span>>with DJ Yella</span>>Monday at 2 PM</span>>No Genre No Show Name</span>>with Katy Cox</span>>Monday at 4 PM</span>>Rap The Greatest</span>>with DJ Fresh</span>>Monday at 5 PM</span>>No Genre Revolution Corner</span>>with Randy Underwood</span>>Monday at 6 PM</span>>No Genre 
????: NamePros.com http://www.namepros.com/showthread.php?t=566856
properly formatted with the time to the left of it and each listing on a new line. Is this possible at all?

250np$ to whoever manages it
Last edited by Joseph; 03-13-2009 at 06:36 PM.
Joseph is offline   Reply With Quote
Old 03-14-2009, 04:33 AM   #2 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,620
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 





You can try this code
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<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;
}
</style>

<script type="text/javascript">
var DayOfWeek = new Array('Weekend','Monday','Tuesday','Wednesday','Th ursday','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][18] = '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'; }
	alert(showOn);
}

function NowON() {
	var dateNow = 4;// this must be set manually with PHP code or such
	var sFound = false;
	var i;
	var s = '';
	if (DH[dateNow] != null) {
		for (i=0;i<=24;i++) {
			if (DH[dateNow][i] != null && DH[dateNow][i] != '') {
				s += DH[dateNow][i];
			}
		}
	}

	if (s == '') {
		s = 'No Show Scheduled';
	}
	if (document.getElementById('idNowOn')) {
		document.getElementById('idNowOn').innerHTML = s;
	}
}
</script>
</head>
<BODY onLoad="NowON()">
<div id="idNowOn" onClick="NowON()">Click For Now On KSWH</div>
</body>
</html>
However the javascript recognizes the current date by "dateNow" variable which i put above.
????: NamePros.com http://www.namepros.com/showthread.php?t=566856
????: NamePros.com http://www.namepros.com/showthread.php?t=566856
You should set it by PHP code.
So that all visitors will see the same schedule no matter with their time zones.
__________________
xrvel is offline   Reply With Quote
Old 06-30-2009, 12:27 PM   #3 (permalink)
First Time Poster!
Join Date: Jun 2009
Posts: 1
WildThayne is an unknown quantity at this point
 



15 Minute Breakdown


I am using this script on a radio station website too. But they have programming broken down into 15 minute segments. I am not a programmer at all, can someone help me add the ability to break the listings down to 15 minute segments with this script. Be glad to compensate anyone that can help. Thanks
WildThayne is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:49 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger