i am having problems attaching an event to a radio button. i am trying to get the values from a clicked radio button so that i can then attach those values to a javascript enclode64. but i don't seem to be able to attach to the event.

it might be easier if i show u what i have done so far;

PHP Code:
<input class="link-selector-flash" type="radio" name="link-type" id="link-type-template" data-url-base="www.sample.url1" />

<
input class="link-selector-flash" type="radio" name="link-type" id="link-type-template" data-url-base="www.sample.url2" />

<
input class="link-selector-flash" type="radio" name="link-type" id="link-type-bespoke" data-url-base="www.sample.url2" /> 

i am having problems attaching an event to a radio button. i am trying to get the values from a clicked radio button so that i can then attach those values to a javascript enclode64. but i don't seem to be able to attach to the event.

it might be easier if i show u what i have done so far;

*The HTML radio button tag: They are NOT enclosed within a form *

<input class="link-selector-flash" type="radio" name="link-type" id="link-type-template" data-url-base="www.sample.url1" />

<input class="link-selector-flash" type="radio" name="link-type" id="link-type-template" data-url-base="www.sample.url2" />

<input class="link-selector-flash" type="radio" name="link-type" id="link-type-bespoke" data-url-base="www.sample.url2" />

the javacript code
PHP Code:
window.onload = function(){

document.getElementsByName('link-type').onclick = function(){
 
alert('it works link name');

  var 
radioButtons document.getElementsByName("link-type");
    for (var 
0radioButtons.lengthi++) {
        if (
radioButtons[i].checked) {

        var 
thevalue  =  radioButtons[i].value;

   
document.getElementById('str64').value Base64.encode(thevalue);
        }
    }

you will note that i tried to place the returned value in a Base64 encode ( i have not enclosed the javacript code for the encoder as this has been separately tested and it works perfectly.

the imput bar that i tried to transfer it to is listed below .
PHP Code:
<input type="text" name="str64" id="str64" size="34" /> 
The code fell apart because i don't seem to be able to attach the right event to the listener. i.e to listen for the click of the radio button.

warm regards

Andreea