View Full Version : Need Radio Button Help ASAP!!!

03-27-2009, 12:56 AM
Ok so I am trying to get this page up and running but I can't get the Javascript to work. Can somebody please take a look at my page and explain exactly what to do? I am new to Javascript. Please don't mind the song list, they are just there temporarily.

The exact instructions are on the page at the bottom in the <p> tag named "instructions". Thanks in advance for the help. I really need to get this finished asap!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hybrid 2 Assignment</title>
margin:10px auto;
font:normal 2.0em "Trebuchet MS", Arial, Helvetica, sans-serif;
padding: 1.0em 2.0em;
padding: 1.0em 2.0em;
font:normal 1.0em/1.2em Verdana, Geneva, sans-serif;
color: #03C;
width: 700px;
margin: auto;
border:1px solid #999;
font: normal 1.6em Verdana, Geneva, sans-serif;
thead tr{
font:bold 12pt Verdana, Geneva, sans-serif;
color: #333;
padding: 0.5em 2em;
font:normal 12pt Verdana, Geneva, sans-serif;
color: #666;
padding: 0.5em 2em;
border:1px solid #999;





window.onload = init;


<div id="wrapper">
<h1>Sample Download Page</h1>
<form name="songForm" id="songForm" action="#" method="post">
<caption>Available Downloads</caption>
<th>File Size</th>
<td colspan="4">
<input type="submit" name="btnDownload" id="btnDownload" value="Download Selected Songs" />
<tr class="odd">
<td><input type="checkbox" name="song_1" id="song_1" value="1" /></td>
<td>The Adventure</td>
<td>Angels and Airwaves</td>
<td>3433 Kb</td>
<tr class="even">
<td><input type="checkbox" name="song_2" id="song_2" value="2" /></td>
<td>Black Fire</td>
<td>4010 Kb</td>
<tr class="odd">
<td><input type="checkbox" name="song_3" id="song_3" value="3" /></td>
<td>Blink 182</td>
<td>3877 Kb</td>
<tr class="even">
<td><input type="checkbox" name="song_4" id="song_4" value="4" /></td>
<td>When Your Heart Stops Beating</td>
<td>plus 44</td>
<td>4123 Kb</td>
<tr class="odd">
<td><input type="checkbox" name="song_5" id="song_5" value="5" /></td>
<td>Anyway You Want It</td>
<td>3914 Kb</td>
<tr class="even">
<td><input type="checkbox" name="song_6" id="song_6" value="6" /></td>
<td>Read My Mind</td>
<td>The Killers</td>
<td>3649 Kb</td>
<tr class="odd">
<td><input type="checkbox" name="song_7" id="song_7" value="7" /></td>
<td>Rebel Yell</td>
<td>Billy Idol</td>
<td>3871 Kb</td>
<tr class="even">
<td><input type="checkbox" name="song_8" id="song_8" value="8" /></td>
<td>Nine in the Afternoon</td>
<td>Panic at the Disco</td>
<td>3255 Kb</td>
<tr class="odd">
<td><input type="checkbox" name="song_9" id="song_9" value="9" /></td>
<td>Lazy Eye</td>
<td>Silversun Pickups</td>
<td>3568 Kb</td>
<p><strong>Instructions: </strong> When the user clicks a checkbox then the background of the row has it's colour changed by adding a CSS class. If they click a checkbox and unselect it then the background of the table row will revert to it's original colour. When the user clicks the Download button then an alert box should pop up and display a list of the song titles in the selected rows.</p>

03-27-2009, 02:51 AM
Seeing as this is your first post, welcome to the forums. Being that it is your first post, I strongly recommend you read the 'how to post a JavaScript question (http://www.codingforums.com/showthread.php?t=2090)' sticky thread. Pay special attention to #3 on that list. Also note that putting "ASAP!!!!" in your subject doesn't garner much respect with people, and dumping what is obviously a homework assignment even less.

At any rate, what you want to do is use the DOM to alter the elements on the page using an onclick event handler. I suggest searching for some tutorials (http://www.lmgtfy.com?q="DOM+tutorial") and doing plenty of reading / troubleshooting. When you have some actual code that you want help debugged, let us know.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum