Jump to content

Wants wrong with my code!!!


Agent Moose

Recommended Posts

I need some help with a code. It is supposed to be a code that what ever option you choose from the drop-down menu, the description and catagory change with it. I don't know why, but the cagatory doesn't show up, and the description doesn't change. I have two code for you to see, the first one is for what I tried when adding the catagorys...it doesn't work right,

<!--MC Radio V2(Shorty)--><div class="tableborder"> <div class='maintitle' align='left'>MC Radio V2</a></div> <table border="0" cellspacing="1" cellpadding="4"> <tr> <th align="center" width="23%" class='titlemedium'>Station</th> <th align="center" width="32%" class='titlemedium'>Description</th> <th align="center" width="20%" class='titlemedium'><center>Genre</center></th> </tr> <tr> <td class="row4" align="center"><b>Listen to </b><form name="form1"><select name="select1" size="1" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')"><option selected value="http://www.1club.fm/clubfm_media/v42.aspx?station=activex" target="newwin">Active Radio X</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=modernrock" target="newwin">Modern Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=classicrock" target="newwin">102 Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hairband">Hair Band Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=techno" target="newwin">Techno Club</option></select> <input type="button" value="Listen" onClick="jumptolink(document.form1.select1)"></form></a></td> <td class="row4"><span id="textcontainer1" align="left" style="font:italic 13px Arial"></span><script type="text/javascript">var thetext1=new Array()thetext1[0]="A hard hitting Rock Channel playing the best in Heavy Metal, Alternative, and 80s Hard Rock on the planet. This is Active Rock. Play It Loud!."thetext1[1]="The Net's New Rock Alternative. An edgy display of Active, Modern, Today & Classic Alternative Rock Music."thetext1[2]="LIVE from a City that built the Classic Rock format. The Best in Classic Rock Music. Take a listen to the legendary bands that started it all."thetext1[3]="he House of Hair Spray and Spandex. Playing your favorite sleaze Rock Anthems of the 80s & early 90s! We're the only station still rockin'."thetext1[4]="Spinning the best in Trance and Techno Club Beats. Live from Chicago, it's the net's home for the best in underground sounds!"</script><br /></td> <td class="row2" align="center"><span id="catagory1" align="center" style="font:italic 13px Arial"></span><script type="text/javascript">var catagory1=new Array()catagory1[0]="Rock"catagory1[1]="Rock"catagory1[2]="Rock"catagory1[3]="Rock"catagory1[4]="Techno"</script><script type="text/javascript">function displaydesc(which, descriptionarray, catagoryarray, container){if (document.getElementById)document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]}function jumptolink(what){var selectedopt=what.options[what.selectedIndex]if (document.getElementById && selectedopt.getAttribute("target")=="newwin")window.open(selectedopt.value)elsewindow.location=selectedopt.value}displaydesc(document.form1.select1, thetext1, catagory1, 'textcontainer1')</script></td></table></div><br><!--End MC Radio V2(Shorty)-->

This code is the one I used before I added the catagorys. Looks the same and it works...

<!--MC Radio V2(Shorty)--><div class="tableborder"> <div class='maintitle' align='left'>Active Radio X</a></div> <table border="0" cellspacing="1" cellpadding="4"> <tr> <th align="center" width="23%" class='titlemedium'>Station</th> <th align="center" width="32%" class='titlemedium'>Description</th> <th align="center" width="20%" class='titlemedium'><center>Genre</center></th> </tr> <tr> <td class="row4" align="center"><b>Listen to </b><form name="form1"><select name="select1" size="1" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')"><option selected value="http://www.1club.fm/clubfm_media/v42.aspx?station=activex" target="newwin">Active Radio X</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=modernrock" target="newwin">Modern Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=classicrock" target="newwin">102 Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hairband">Hair Band Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=techno" target="newwin">Techno Club</option></select> <input type="button" value="Listen" onClick="jumptolink(document.form1.select1)"></form></a></td> <td class="row4"><span id="textcontainer1" align="left" style="font:italic 13px Arial"></span><script type="text/javascript">var thetext1=new Array()thetext1[0]="A hard hitting Rock Channel playing the best in Heavy Metal, Alternative, and 80s Hard Rock on the planet."thetext1[1]="The Net's New Rock Alternative. An edgy display of Active, Modern, Today & Classic Alternative Rock Music."thetext1[2]="LIVE from a City that built the Classic Rock format. Take a listen to the legendary bands that started it all."thetext1[3]="The House of Hair Spray and Spandex. Playing your favorite sleaze Rock Anthems of the 80s & early 90s!"thetext1[4]="Spinning the best in Trance and Techno Club Beats. Live from Chicago, it's the net's home for the best in underground sounds!"</script><br /></td> <td class="row2" align="center"><script type="text/javascript">function displaydesc(which, descriptionarray, container){if (document.getElementById)document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]}function jumptolink(what){var selectedopt=what.options[what.selectedIndex]if (document.getElementById && selectedopt.getAttribute("target")=="newwin")window.open(selectedopt.value)elsewindow.location=selectedopt.value}//2) Call function displaydesc() for each drop down menu you have on the page//   This function displays the initial description for the selected menu item//   displaydesc(name of select menu, name of corresponding text array, ID of SPAN container tag)://   Important: Remove the calls not in use (ie: 2nd line below if there's only 1 menu on your page)displaydesc(document.form1.select1, thetext1, 'textcontainer1')</script></td></table></div><br><!--End MC Radio V2(Shorty)-->

First one doesn't work proporly, second one does, but it doesn't have the catagorys...if anyone wants to help me, please do...if that even makes sence...-Agent Moose

Link to comment
Share on other sites

In the first code, your display function looks like this (four parameters):

function displaydesc(which, descriptionarray, catagoryarray, container)

But when you call the function in the select, you call it like this (three parameters):

onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')"

You should probably change it to this:

onChange="displaydesc(document.form1.select1, thetext1, catagory1, 'textcontainer1')"

Just FYI, these two pieces of code are the same:

<select name="select1" onchange="someFunction(document.form1.select1);">

<select name="select1" onchange="someFunction(this);">

Link to comment
Share on other sites

It still doesn't work. I changed the thing you told me too. I also changed some things with the code to, just the name of the arrays and things like that...

<!--MC Radio V2(Shorty)--><div class="tableborder"> <div class='maintitle' align='left'>MC Radio V2</a></div> <table border="0" cellspacing="1" cellpadding="4"> <tr> <th align="center" width="23%" class='titlemedium'>Station</th> <th align="center" width="32%" class='titlemedium'>Description</th> <th align="center" width="20%" class='titlemedium'><center>Genre</center></th> </tr> <tr> <td class="row4" align="center"><b>Listen to </b><form name="form1"><select name="station" size="1" onChange="displaydesc(document.form1.station, description, catagory, 'textcontainer1')"><option selected value="http://www.1club.fm/clubfm_media/v42.aspx?station=activex" target="newwin">Active Radio X</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=modernrock" target="newwin">Modern Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=classicrock" target="newwin">102 Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hairband">Hair Band Rock</option><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=techno" target="newwin">Techno Club</option></select><input type="button" value="Listen"onClick="jumptolink(document.form1.station)"></form></a></td> <td class="row4"><span id="textcontainer1" align="left" style="font:italic 13px Arial"></span><script type="text/javascript">var description=new Array()description[0]="A hard hitting Rock Channel playing the best in Heavy Metal, Alternative, and 80s Hard Rock on the planet."description[1]="The Net's New Rock Alternative. An edgy display of Active, Modern, Today & Classic Alternative Rock Music."description[2]="LIVE from a City that built the Classic Rock format. Take a listen to the legendary bands that started it all."description[3]="The House of Hair Spray and Spandex. Playing your favorite sleaze Rock Anthems of the 80s & early 90s!"description[4]="Spinning the best in Trance and Techno Club Beats. Live from Chicago, it's the net's home for the best in underground sounds!"</script><br /></td> <td class="row2" align="center"><span id="textcontainer1" align="center" style="font:italic 13px Arial"></span><script type="text/javascript">var catagory=new Array()catagory[0]="Rock"catagory[1]="Rock"catagory[2]="Rock"catagory[3]="Rock"catagory[4]="Techno"</script><script type="text/javascript">function displaydesc(which, descriptionarray, catagoryarray, container){if (document.getElementById)document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]}function jumptolink(what){var selectedopt=what.options[what.selectedIndex]if (document.getElementById && selectedopt.getAttribute("target")=="newwin")window.open(selectedopt.value)elsewindow.location=selectedopt.value}displaydesc(document.form1.station, description, catagory, 'textcontainer1')</script></td></table></div><br><!--End MC Radio V2(Shorty)-->
Anything wrong???
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...