Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[code] <html><head> <script type=

Status
Not open for further replies.

gronsky

Technical User
Feb 8, 2002
36
0
0
US
Morning,

HELP!

In a, somewhat, perfect world what should happen in the following code is that the customer ticks the checkbox for a particular Production Date and then chooses how many Adult and/or Children tickets they need for that production.

The code below is an abbreviated one for the purpose of posting here. There are several more checkboxes and more options in each dropdown list.

What I would like to do is see which checkbox was ticked and using document.write write the values from the checkbox and dropdown list.

My question is; what do I put in the document.write?????


Code:
<html><head>
<script type=&quot;text/javascript&quot;>
function check()
{
   tickets=document.forms[0].ch_BOX
   for (i = 0; i<tickets.length; ++ i)
    {
     if (tickets[i].checked)
      {
        document.write(   )
      }
    }

}
</script>
</head><body>
<form name=myForm>
<table width=&quot;80%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;>
  <tr>
    <td colspan=&quot;2&quot;>Production Date</td>
    
    <td>Adult Ticket</td>
    <td>Children Ticket</td>
  </tr>
  <tr>
    <td><input type=&quot;checkbox&quot; name=&quot;ch_BOX&quot; value=&quot;Friday, May 7, 2004  8:00 PM&quot;>Friday, May 7, 2004</td>
    <td> </td>
    <td><select name=ticketA1 size=1>
                        <option value=&quot;0.00&quot; selected>            </option>
                        <option value=&quot;10.00&quot;>1</option>
                        <option value=&quot;20.00&quot;>2</option>
                        <option value=&quot;30.00&quot;>3</option>
                       </select></td>
    <td><select name=ticketC1 size=1>
                        <option value=&quot;0.00&quot; selected>            </option>
                        <option value=&quot;8.00&quot;>1</option>
                        <option value=&quot;16.00&quot;>2</option>
                        <option value=&quot;24.00&quot;>3</option>
                       </select></td>
  </tr>
  <tr>
    <td><input type=&quot;checkbox&quot; name=&quot;ch_BOX&quot; value=&quot;Saturday, May 8, 2004  8:00 PM&quot;>Saturday, May 8, 2004</td>
    <td> </td>
    <td><select name=ticketA2 size=1>
                        <option value=&quot;0.00&quot; selected>            </option>
                        <option value=&quot;10.00&quot;>1</option>
                        <option value=&quot;20.00&quot;>2</option>
                        <option value=&quot;30.00&quot;>3</option>
                       </select><br></td>
    <td><select name=ticketC2 size=1>
	                    <option value=&quot;0.00&quot; selected>            </option>
                        <option value=&quot;8.00&quot;>1</option>
                        <option value=&quot;16.00&quot;>2</option>
                        <option value=&quot;24.00&quot;>3</option>
                       </select></td>
  </tr>

</table>
<br>
<input type=&quot;button&quot; name=&quot;test&quot; onclick=&quot;check()&quot; value=&quot;Order&quot;>
</form></body></html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top