Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

layer objects in netscape

Status
Not open for further replies.

kmantrip

Programmer
Oct 30, 2000
1
US
I created a questionnaire kind of form, works just fine using IE (using DIV
object) , want to get it up in
netscape too.


I am having problem displaying objects within a layer in netscape browser
(netscape communicator 4.5 ):

<input NAME=&quot;Q1&quot; VALUE=&quot;Q11&quot; TYPE=&quot;radio&quot; OnClick=ValidateQ1()>Yes

On the click of the radio button , I am calling the function ValidateQ1,
which in turn should show the radlay1, which has another set of radio
buttons.
But all it shows is just the text beside the radio objects, but not the
buttons. However it does show the objects if I put another form tag inside
the layer object as below:


<LAYER NAME=&quot;Radlay1&quot; VISIBILITY=HIDE>
<form name=&quot;radform&quot;>
2. How often do you use the Internet? <BR>
<INPUT Type=&quot;radio&quot; name=&quot;Q2&quot; value=&quot;Q21&quot;
OnClick=ValidateQ2()>Hardly Ever   
<INPUT Type=&quot;radio&quot; name=&quot;Q2&quot; value=&quot;Q22&quot;
OnClick=ValidateQ2()>Approximately once a month <BR>

</form>
</LAYER>

But here I am getting a javascript error at document.form1.Q2[0].checked
within the called function ValidateQ2().

function ValidateQ2() {
if (document.form1.Q2[0].checked){
alert (&quot;Option 1&quot;);
} else {
alert (&quot;Option 2&quot;);
}
}

Any help is greately appreciated. thanks in advance.


Here is the entire CODE:


<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
</HEAD>
<BODY>

<BODY bgcolor=&quot;#FFFFFF&quot; &quot;&quot; link=&quot;#004000&quot; vlink=&quot;#000000&quot; alink=&quot;#C0C0C0&quot;
topmargin=&quot;0&quot;
leftmargin=&quot;1&quot; style=&quot;margin-right: 15&quot;>
<HR color=#004000 SIZE=5>
<form name=&quot;form1&quot; method=&quot;get&quot; action=&quot;xxxxx.asp&quot;>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

<!--

function ValidateQ1() {

if (navigator.appName == &quot;Netscape&quot;
&& parseInt(navigator.appVersion) >= 4) {
if (document.form1.Q1[0].checked){
document.Radlay1.visibility = &quot;SHOW&quot;;
}
else
{
document.Radlay1.visibility = &quot;HIDE&quot;;
}

}
}
function ValidateQ2() {
if (document.form1.Q2[0].checked){
alert (&quot;Option 1&quot;);
}
else {
alert (&quot;Option 2&quot;);
}
}

// -->
</SCRIPT>

<form name=&quot;form1&quot; method=&quot;get&quot; action=&quot;PostTrans.asp&quot;>

<FONT face=Arial color=blue size=2><STRONG>To properly place you in a class
that will best suit your needs, please answer the following
questions</STRONG></FONT></P>
<FONT color=black>

1. Do you currently use Realcomp's MLS?</FONT><BR>
<DIV align=&quot;left&quot;>
<input NAME=&quot;Q1&quot; VALUE=&quot;Q11&quot; TYPE=&quot;radio&quot; OnClick=ValidateQ1()>Yes
 <input NAME=&quot;Q1&quot; VALUE=&quot;Q12&quot; TYPE=&quot;radio&quot;
OnClick=ValidateQ1()> No
</DIV>

<LAYER NAME=&quot;Radlay1&quot; VISIBILITY=HIDE>

2. How often do you use the Internet? <BR>

<INPUT Type=&quot;radio&quot; name=&quot;Q2&quot; value=&quot;Q21&quot;
OnClick=ValidateQ2()>Hardly Ever   
<INPUT Type=&quot;radio&quot; name=&quot;Q2&quot; value=&quot;Q22&quot;
OnClick=ValidateQ2()>Approximately once a month <BR>

</LAYER>

</FORM>
</BODY>
</HTML>
 
It seems that the <LAYER> enclosed within your original <FORM> is not considered part of the form, which is why you have to include the declaration for <FORM name=radform...> within the layer. Having done this, then you will need to use this formname when validating Q2: -

function ValidateQ2() {
if (document.radform.Q2[0].checked){
alert (&quot;Option 1&quot;);
} else {
alert (&quot;Option 2&quot;);
}
}

HTH :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top