...

View Full Version : <--Javascript N00b here.



gorikain
09-21-2005, 11:54 PM
I have two radio checkboxes that each have a numeric value assigned to them.
I want their value to appear in a text input field when one is selected.

Anyone know how to do that?

CrAzY_J
09-22-2005, 12:14 AM
<script type="text/javascript">
function show(check,text){
document.getElementById(text).value+=document.getElementById(check).value;
}
</script>


assign the function to the radio button on the event "onClick",the first argument is the checkbox id and the second is the textbox id.

gorikain
09-22-2005, 07:20 PM
:)
Thanks.

Sorry to be a pain, but I can't figure out what I'm doing wrong.
Here's what I have. I'm probably missing something obvious....




<html>
<head>

<script type="text/javascript">
function show(usmail,shipping){
document.getElementById(shipping).value+=document.getElementById(usmail).value;
}



function show(nextday,shipping){
document.getElementById(shipping).value+=document.getElementById(nextday).value;
}
</script>


</head>


<body>
<input type="radio" name="radio1" value=5.95 id="usmail"
onClick="show(usmail,shipping);">
<input type="radio" name="radio1" value=8.95 id="nextday"
onClick="show(usmail,shipping);">

<input type="text" id="shipping">
</body>

</html>


:)

_Aerospace_Eng_
09-22-2005, 07:26 PM
<html>
<head>

<script type="text/javascript">
function show(what,where){
document.getElementById(where).value=document.getElementById(what).value;
}
</script>


</head>


<body>
<input type="radio" name="radio1" value="5.95" id="usmail"
onClick="show('usmail','shipping');">
<input type="radio" name="radio1" value="8.95" id="nextday"
onClick="show('nextday','shipping');">
<input type="text" id="shipping">
</body>

</html>

gorikain
09-22-2005, 07:32 PM
ohhh, haha.
Man, I feel dumb.

Thanks a ton!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum