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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate text box from link in table, then add together

Status
Not open for further replies.

canajun

Programmer
Sep 28, 2002
57
CA
I would like to populate textboxes with a value from a link in 3 tables, and then add them all together:

Code:
<body>
<form action="myfile.php" method="get">
<table width="200" border="1">
  <tr>
    <td><a href="#" onclick="setprice1(); return false;">1.00</a></td>
    <td><a href="#" onclick="setprice1(); return false;">2.00</a></td>
    <td><a href="#" onclick="setprice1(); return false;">3.00</a></td>
  </tr>
</table>
<input name="price1" type="text" size="6" />
<table width="200" border="1">
  <tr>
    <td><a href="#" onclick="setprice2(); return false;">1.00</a></td>
    <td><a href="#" onclick="setprice2(); return false;">2.00</a></td>
    <td><a href="#" onclick="setprice2(); return false;">3.00</a></td>
  </tr>
</table>
<input name="price2" type="text" size="6" />
<table width="200" border="1">
  <tr>
    <td><a href="#" onclick="setprice3(); return false;">1.00</a></td>
    <td><a href="#" onclick="setprice3(); return false;">2.00</a></td>
    <td><a href="#" onclick="setprice3(); return false;">3.00</a></td>
  </tr>
</table>
<input name="price3" type="text" size="6" /><br>

<input name="price_total" type="text" size="6" />


</form>
</body>

Any help with a javascript to do this would be appreciated..

Thanks
 
Can you post your attempt at the functions setprice1, setprice2, and setprice3?

<.

 
I haven't attempted anything, as I don't know where to start....
 
Is this for a homework assignment?

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
no.. I haven't been in school for many years.
 
I ask cause this is just basic beginner level stuff. Quantity * price = total, display to screen. It's a very common homework assignment.

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Well, I am practicing at a beginner level when it comes to this, hence, I need some help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top