Hi All,
I have a webpage which has two radio buttons. There is a label also in the web page. I want the label string to be based on the radio button status. I am able to change when somebody press the radio button using "onclick" function, but now when the page is reloaded.
Here is my code
I want the highlighted label value to be changed based on the radio button value at the start up itself( ie if the page get reloaded if some error has happend at filling the form)Code:<body leftmargin="10" rightmargin="10" topmargin="0" > <script type="text/javascript"> function changeText(val) { if (val==1){ document.getElementById('usemobemail').innerHTML = 'Mobile No'; } else if (val==2) { document.getElementById('usemobemail').innerHTML = 'Email ID'; } } </script> <html:form action="register" method="post" focus="newusername"> <center> <table border="0" cellpadding="2" cellspacing="12" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3"> <tr> <td width="100%" colspan="6" align="center" valign="top"><html:errors/></td> </tr> <tr> <td width="10%" colspan="2" align="center"> <html:radio property="regradio" id='viamobi' VALUE="viamob" onclick="changeText(1)"></html:radio> Register via mobile number</td> <td width="10%" colspan="2" align="center"> <html:radio property="regradio" id='viaAAsys' onclick='changeText(2)' VALUE="viaAA" ></html:radio> Register via AA System number </td> </tr> <tr> <td width="10%"> </td> <td width="10%"><font face="Verdana" size="2"><label id ='usemobemail' >Mobile No</label></font></td> <td width="10%"> <html:text property='regusing' /></td> <td width="10%"> </td> </tr> </table> </center> </html:form> </table> </body>


Reply With Quote
Bookmarks