|
-
Radio Forms
First off, I am sorry...new to java and new to the forum.
But I am trying to write a radio button form that has dynamic output.
If radio 1 selected then the text would say "one", if radio 2 text = "two", etc
for example :
How many chickens do you own?
Radio 1
Radio 2
*Radio 3
Radio 4
I own three chickens.
I have the following and am stuck, can I stack getElementsbyid...?
Code:
<script type="text/javascript">
function check() {
document.getElementById('Radio1').firstChild.nodeValue='one';
}
<form>
<input type="radio" value="0" id="r1" name="r1" onclick="check()" />
<input type="radio" ???? />
<input type="radio" ???? />
<input type="radio" ???? />
</form>
I own <label for="r1" id="Radio1">blank</label> chickens.
any help would be greatly appreciated
-
<script type="text/javascript">
function check(x) {
document.getElementById('Radio1').innerHTML = x;
}
<form>
<input type="radio" value="one" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="two" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="three" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="four" id="r1" name="r1" onclick="check(this.value);" />
</form>
I own <label for="r1" id="Radio1">blank</label> chickens.
-
That did it
It worked
This is one of the better forums Im going to spam this thread with 'thanks'
not really...but thank you very much.
-
That did it
 Originally Posted by WolfShade
<script type="text/javascript">
function check(x) {
document.getElementById('Radio1').innerHTML = x;
}
<form>
<input type="radio" value="one" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="two" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="three" id="r1" name="r1" onclick="check(this.value);" />
<input type="radio" value="four" id="r1" name="r1" onclick="check(this.value);" />
</form>
I own <label for="r1" id="Radio1">blank</label> chickens.
Thank you soo much worked like a charm
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks