charnel
06-19-2006, 08:50 PM
I cannot make javascript to write a message to the screen after clicking a radio button.
I tried onclick and I tried to make a function for that can anyone help me ?? ?
the first script is in the head part of my page
------------------
function form() {
if (document.user_form.radio== "yes"){
document.write ("yes");
}
if (document.user_form.radio=="no"){
document.write ("no");
}
-----------------
and at the body part teh radio button tags are like this
------------------
<input name="radio" type="radio" value="yes" onClick="form()">
<input name="radio" type="radio" value="no" onClick="referal()">
------------------
wheres my mistake. by the way I just wrote this code for testin. My aim is to insert html. Like when user clicks yes another form field is going to be added to the form page. Can anyone help me on that ? ? ? ?
I tried onclick and I tried to make a function for that can anyone help me ?? ?
the first script is in the head part of my page
------------------
function form() {
if (document.user_form.radio== "yes"){
document.write ("yes");
}
if (document.user_form.radio=="no"){
document.write ("no");
}
-----------------
and at the body part teh radio button tags are like this
------------------
<input name="radio" type="radio" value="yes" onClick="form()">
<input name="radio" type="radio" value="no" onClick="referal()">
------------------
wheres my mistake. by the way I just wrote this code for testin. My aim is to insert html. Like when user clicks yes another form field is going to be added to the form page. Can anyone help me on that ? ? ? ?