M
michael
apologies in advance, as not only am i new to learning how to code
javascript properly, i'm new to the groups posting thing...
i am developing in firefox 1.0+, but will be working in an msie 6.0+
produciton environment ( not my choice, but when is it ever? ).
the desired output is that when the end-user selects two radio buttons,
one from each 'group', the form / page will open an alert window
displaying the values of the radio buttons selected without having the
end-user left-click on a submit button.
i cannot figure out why I'm getting the "document.[formName] has no
properties" error mesasage in the javascript console.
any advice, assistance, comments or suggestions will be appreciated.
michael
this is what i've got thus far - - -
( located within the head tags )
<script language = "javascript" type = "text/javascript">
var myFirstVariable = "";
var mySecondVariable = "";
function optionSelected ()
{
for (i = 0; i < 4; i++);
{
if (document.[formName].myFirstVariablechecked == true);
{
firstVariableName = document.[formName].myFirstVariable.value;
}
}
for (i = 0; i < 1; i++);
{
if (document.[formName].mySecondVariable.checked == true);
{
seconVariableName = document.[formName].mySecondVariable.value;
}
}
alert("the radio buttons selected were + " + firstVariableName + " and
" + secondVariableName + ".");
}
</script>
....and then my form looks like...
( located within the body tags )
<form name = "formName">
<p>
<input type = "radio" name = "myFirstVariable" value = "option1"
onClick = "optionSelected()">Option1<br>
<input type = "radio" name = "myFirstVariable" value = "option2"
onClick = "optionSelected()">Option2<br>
<input type = "radio" name = "myFirstVariable" value = "option3"
onClick = "optionSelected()">Option3<br>
<input type = "radio" name = "myFirstVariable" value = "option4"
onClick = "optionSelected()">Option4<br>
<input type = "radio" name = "myFirstVariable" value = "option5"
onClick = "optionSelected()">Option5<br>
</p>
<p>
<input type = "radio" name = "mySecondVariable" value = "option1"
onClick = "optionSelected()">Option1<br>
<input type = "radio" name = "mySecondVariable" value = "option2"
onClick = "optionSelected()">Option2<br>
</p>
</form>
javascript properly, i'm new to the groups posting thing...
i am developing in firefox 1.0+, but will be working in an msie 6.0+
produciton environment ( not my choice, but when is it ever? ).
the desired output is that when the end-user selects two radio buttons,
one from each 'group', the form / page will open an alert window
displaying the values of the radio buttons selected without having the
end-user left-click on a submit button.
i cannot figure out why I'm getting the "document.[formName] has no
properties" error mesasage in the javascript console.
any advice, assistance, comments or suggestions will be appreciated.
michael
this is what i've got thus far - - -
( located within the head tags )
<script language = "javascript" type = "text/javascript">
var myFirstVariable = "";
var mySecondVariable = "";
function optionSelected ()
{
for (i = 0; i < 4; i++);
{
if (document.[formName].myFirstVariablechecked == true);
{
firstVariableName = document.[formName].myFirstVariable.value;
}
}
for (i = 0; i < 1; i++);
{
if (document.[formName].mySecondVariable.checked == true);
{
seconVariableName = document.[formName].mySecondVariable.value;
}
}
alert("the radio buttons selected were + " + firstVariableName + " and
" + secondVariableName + ".");
}
</script>
....and then my form looks like...
( located within the body tags )
<form name = "formName">
<p>
<input type = "radio" name = "myFirstVariable" value = "option1"
onClick = "optionSelected()">Option1<br>
<input type = "radio" name = "myFirstVariable" value = "option2"
onClick = "optionSelected()">Option2<br>
<input type = "radio" name = "myFirstVariable" value = "option3"
onClick = "optionSelected()">Option3<br>
<input type = "radio" name = "myFirstVariable" value = "option4"
onClick = "optionSelected()">Option4<br>
<input type = "radio" name = "myFirstVariable" value = "option5"
onClick = "optionSelected()">Option5<br>
</p>
<p>
<input type = "radio" name = "mySecondVariable" value = "option1"
onClick = "optionSelected()">Option1<br>
<input type = "radio" name = "mySecondVariable" value = "option2"
onClick = "optionSelected()">Option2<br>
</p>
</form>