Onclick change value of input

The following code should change the value of the input named “voto” by clicking on the radio button, but it doesn’t why?


<input name="cualquiera" type="radio" value="<%=encuestas(respuesta)%>" onclick="javascript:document.getElementById('voto').value=<%=encuestas%>"/><%=encuestas%>    
 <input type="text" name="voto" />

The input object must have an id


I have changed it to : id = “voto”, but i still dont have solved the problem.

The following will work

<input name="cualquiera" type="radio" value="respuesta" onclick="javascript:document.getElementById('voto').value='test'"/>

 <input type="text" name="voto" id="voto" />