Sorry folks. It's this old script again to place a "what' playing now" on our radio website.
I've tried to assemble this below from previous examples doing the rounds, but it refuses to work.
Is there anyone here (everyone, in my case!) with more experience than me (be kind, my experience is basic so it will have to be in "download from the web" rather than "web scraping" (ugh!) terminology!) who might be able to identify why this isn't working?
Many thanks indeed
Ed - the Hon Webmaster
The code I have placed in the page header is (I have removed some of the daily schedule because this forum limits me to 10,000 characters). It's the same each day, divided into on-the-hour lines:
-------------------------------------------
--------------------------------------------------------------------Code:function getSchedule(day) { var schedule = "" ; for(i = 0 ; i < 24 ; i++) { if(DH[day][i] != "") schedule += DH[day][i] ; } return schedule ; }
The full code placed in an HTML box on our web page is:
--------------------------------------------------------------------
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.1 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','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[0][0] = 'Saturday at midnight<br>Press Review<br>followed at 12.30am by<br>New to You'; DH[0][1] = 'Sunday at 1am<br>Ed's Surreal Hour'; DH[0][2] = 'Sunday at 2am<br>Country Music'; DH[0][3] = 'Sunday at 3am<br>Rock Music'; DH[0][4] = 'Sunday at 4am<br>Half Hour Special<br>followed at 4.30am by<br>Music'; DH[0][5] = 'Sunday at 5am<br>Donisthorpe Diary<br>followed at 5.30am by<br>The Merry Widower'; DH[0][6] = 'Sunday at 6am<br>What's on in Leeds<br>followed at 6.30am by<br>Comedy Capers'; DH[0][7] = 'Sunday at 7am<br>Seven Day Ramble<br>followed at 7.30am by<br>Mankoff's Half Hour'; DH[0][8] = 'Sunday at 8am<br>Music<br>followed at 8.30am by<br>Live and Let Live'; DH[0][9] = 'Sunday at 9am<br>Poets' Corner<br>followed at 9.30am by<br>Israel Viewpoint'; DH[0][10] = 'Sunday at 10am<br>Today with Lesley'; DH[0][11] = 'Sunday at 11am<br>Pop Music'; DH[0][12] = 'Sunday at 12pm<br>Press Review<br>followed at 12.30pm by<br>Comedy Capers'; DH[0][13] = 'Sunday at 1pm<br>Listen'; DH[0][14] = 'Sunday at 2pm<br>Torah Talk<br>followed at 2.30pm by<br>The Merry Widower'; DH[0][15] = 'Sunday at 3pm<br>Ed's Surreal Hour'; DH[0][16] = 'Sunday at 4pm<br>New to You<br>followed at 4.30pm by<br>Money Matters'; DH[0][17] = 'Sunday at 5pm<br>Community Hour'; DH[0][18] = 'Sunday at 6pm<br>J-Talk<br>followed at 6.30pm by<br>Classic HM'; DH[0][19] = 'Sunday at 7pm<br>Relax with Harry'; DH[0][20] = 'Sunday at 8pm<br>Mankoff's Half Hour<br>followed at 8.30pm by<br>Seven Day Ramble'; DH[0][21] = 'Sunday at 9pm<br>Poets' Corner<br>followed at 9.30pm by<br>Meet your Rep'; DH[0][22] = 'Sunday at 10pm<br>Rock Music'; DH[0][23] = 'Sunday at 11pm<br>Police Forum<br>followed at 11.30pmby<br>Music'; DH[1][0] = 'Sunday at Midnight<br>Donisthorpe Diaries<br>followed at Monday 12.30am by<br>Music'; DH[1][1] = 'Monday at 1am<br>Press Review<br>followed at 1.30am by<br>Mankoff's Half Hour'; DH[1][2] = 'Monday at 2am<br>Jazz Music'; DH[1][3] = 'Monday at 3am<br>Torah Talk<br>followed 3.30am by<br>New to You'; DH[1][4] = 'Monday at 4am<br>Israel Viewpoint<br>followed at 4.30am by<br>J-Talk'; DH[1][5] = 'Monday at 5am<br>Brass Music'; DH[1][6] = 'Monday at 6am<br>Relax with Harry'; DH[1][7] = 'Monday at 7am<br>No People like Show People<br>with Barry Abis'; DH[1][8] = 'Monday at 8am<br>Today with Lesley'; DH[1][9] = 'Monday at 9am<br>The Merry Widower<br>followed at 9.30am by<br>Music'; DH[1][10] = 'Monday at 10am<br>Comedy Capers<br>followed at 10.30am by<br>Classic HM'; DH[1][11] = 'Monday at 11am<br>Mankoff's Half Hour<br>followed at 11.30am by<br>Seven Day Ramble'; DH[1][12] = 'Monday at 12pm<br>Money Matters<br>followed at 12.30pm by<br>Police Forum'; DH[1][13] = 'Monday at 1pm<br>70's to 90's Music'; DH[1][14] = 'Monday at 2pm<br>Meet your Rep<br>followed at 2.30pm by<br>Music'; DH[1][15] = 'Monday at 3pm<br>Ed's Surreal Hour'; DH[1][16] = 'Monday at 4pm<br>J-Talk<br>followed at 4.30pm by<br>New to You'; DH[1][17] = 'Monday at 5pm<br>Israel Viewpoint<br>followed at 5.30pm by<br>Music'; DH[1][18] = 'Monday at 6pm<br>Half-hour Special<br>followed at 6.30pm by<br>Music'; DH[1][19] = 'Monday at 7pm<br>Poet's Corner<br>followed at 7.30pm by<br>Music'; DH[1][20] = 'Monday at 8pm<br>Relax with Harry'; DH[1][21] = 'Monday at 9pm<br>What's on in Leeds<br>followed at 9.30pm by<br>Music'; DH[1][22] = 'Monday at 10pm<br>Listen'; DH[1][23] = 'Monday at 11pm<br>Comedy Capers<br>followed at 11.30pm by<br>Seven Day Ramble'; DH[2][0] = 'Monday at Midnight<br>Music<br>followed at 1.30am by<br>Torah Talk'; DH[2][1] = 'Tuesday at 1am<br>Relax with Harry'; DH[2][2] = 'Tuesday at 2am<br>Donisthorpe Diary<br>followed at 2.30am by<br>Israel Viewpoint'; DH[2][3] = 'Tuesday at 3am<br>Mankoff's Half Hour<br>followed at 3.30am by<br>Meet your rep'; DH[2][4] = 'Tuesday at 4am<br>Money Matters<br>followed at 4.30am by<br>The Merry Widower'; Remainder of days in week follows this format, then to end of Friday: DH[5][21] = 'No broadcasting<br>Shabbat break<br>Back at 9pm tomorrow'; DH[5][22] = 'No broadcasting<br>Shabbat break<br>Back at 9pm tomorrow'; DH[5][23] = 'No broadcasting<br>Shabbat break<br>Back at 9pm tomorrow'; DH[6][0] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][1] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][2] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][3] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][4] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][5] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][6] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][7] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][8] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][9] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][10] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][11] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][12] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][13] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][14] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][15] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][16] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][17] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][18] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][19] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][20] = 'No broadcasting<br>Shabbat break<br>Back at 9pm this evening'; DH[6][21] = 'Saturday at 9pm<br>Relax with Harry'; DH[6][22] = 'Saturday at 10pm<br>Today with Lesley'; DH[6][23] = 'Saturday at 11pm<br>Saturday Music Hour'; 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 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>



Reply With Quote



Bookmarks