473,320 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Radio button and text link

Hello,

Is it possible to use a text link to enable a radio button, just like some
windows interfaces, when the text is clicked, the radio button gets
selected.....

This works for a checkbox:
in head:
function changeBox(cbox) {
box = eval(cbox);
box.checked = !box.checked;
}

Then as link:
<a href="" onClick="changeBox('document.form1.textfield');ret urn
false">click this<a>

But I want it to select a radio button instead of a checkbox....
anyone?
Jul 23 '05 #1
1 2203
On Mon, 25 Oct 2004 14:58:05 +0200, Kwart246 <kw*********@hotmail.com>
wrote:
Is it possible to use a text link to enable a radio button, just like
some windows interfaces, when the text is clicked, the radio button gets
selected.....
That's what LABELs are for.

<label for="controlId">Label text
<input id="controlId" type="radio" ...>
</label>

The for/id combination, or the control-as-content can be used separately,
but I've read that some older browsers only understand one, so its best to
combine both.
This works for a checkbox:
in head:
function changeBox(cbox) {
box = eval(cbox);
box.checked = !box.checked;
}
function changeRadio(rad) {
rad.checked = true;
}
Then as link:
<a href=""
Make that "#". IE doesn't recognise an empty URI as the current document
(though it does with the FORM action attribute). Stupid piece of junk.
onClick="changeBox('document.form1.textfield');ret urn false">click
this<a>


It would be far more sensible to pass a reference to the function, not a
string which you then coerce into a reference.

onclick="changeRadio(document.formName.elementName );return false;"

Though I prefer use of the forms and elements collections.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with...
1
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
7
by: IchBin | last post by:
I am trying to programmatically set a radio button in a table of radio buttons. I have two problems with the code below: 1 - I can not prepare the <Formstatement to be printed by php. (syntax...
2
by: Peted | last post by:
I have 6 radio buttons in a column with a single line text box next to each rb. is there a general straightforward way to link a radio button to the textbox next to it. I want to be able to...
3
by: jahphill | last post by:
Hey. I thought id make a seperate discusion because the other became a bit lengthy and confusing. Aim: Create a php file which works with the script below, which makes the radiobuttons work =D...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
3
by: santhosh89 | last post by:
hi guys, see i want to develop a script and developed one but it s not working. the concept is there will be three radio buttons. the user has to check one radio button and click the button next...
4
by: Bernie | last post by:
Hello all, I am new to the group and new to javascripting, so I am hoping to find some good help here. Here is a snippet of my code: HTML: Name: <input type="text" name="ageName0"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.