Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: find no. of layers inside nested positioned div


Message #1 by speedguru@m... on Wed, 19 Dec 2001 07:45:46
hi,

thanks a zillion chris..there's hope after all.

i now face a bigger problem .... 

i'm working on a variation of the Tree at codeandhacks.com . I've modified the original code to handle Forms . its is at
http://www.geocities.com/mvar2001/jaytree.htm . i can retrieve the form values in IE but i have trouble in Netscape . the layers are
further subdivided into sub-layers . I have to access the Form values inside those sub-layers . I could not make much headway based
on the tip you provided. I'll be v. grateful if u can  pls let me know where i can find the documentation & examples related to 
fetching accessing sub-layers [values from Forms inside positioned div tags which are further nested in a positioned div] or better
still (this is going to be the height of immodesty ;-)) help me with the code to display selected checkboxes in Netscape similar to
the IE functionality.

I'm reposting this with more details regarding the script

thanks a lot, once again
:-)rk


> Hi,
> 
> document.layer6.layers.length  will return the number of layers within
> layer6 (have only checked this in NS 4.6).
> 
> Hope this is what you were after,
> 
> Chris
> 
> ----- Original Message -----
> From: <speedguru@m...>
> To: "javascript" <javascript@p...>
> Sent: Wednesday, December 19, 2001 7:45 AM
> Subject: [javascript] find no. of layers inside nested positioned div
> 
> 
> > hi,
> >
> > i'm trying to find out the no. of layers inside a nested positioned div in
> Netscape . when i try out the code below (nested div has  been commented
> below) with the nested div, it returns the no. of layers as 1 .
> > code works fine if div's are not nested . its going to be bad news for me,
> if there is absolutely no workaround at all to this.
> > i desperately need help to make this nested positoned div tag to work &
> show the no. of layers inside in Nutscape.
> > <script>
> > function sendForm() {
> > var str="";
> > for (i=1;i<document.layers.length;i++){
> > if (document.layers[i].document.forms[0].elements[0].checked==1){
> > str+=document.layers[i].document.forms[0].elements[0].value+ "|"
> > }
> > }
> > alert(str);
> > }
> > function count() {
> > alert(document.layers.length)
> > }
> > </script>
> > <STYLE TYPE="text/css">
> > <!--
> > #layer1 {position:absolute;left:40; top:30; width:200;visibility:visible;}
> > #layer2 {position:absolute;left:40; top:60; width:200;visibility:visible;}
> > #layer3 {position:absolute;left:40; top:90; width:200;
> visibility:visible;}
> > #layer4 {position:absolute;left:40; top:100; width:200;
> visibility:visible;}
> > #layer5 {position:absolute;left:40; top:130; width:200;
> visibility:visible;}
> > #layer6 {position:absolute;left:40; top:150;
> width:200;visibility:visible;}
> > -->
> > </STYLE>
> > <body>
> > <!-- <div id='layer6'> -->
> > <div id='layer5'>
> > <form name="mainForm">
> > <INPUT TYPE="Hidden" NAME="field1">
> > <INPUT TYPE="Hidden" NAME="field2">
> > <INPUT TYPE="Hidden" NAME="field3">
> > <a href='javascript:count();sendForm()'>submit</a>
> > </form>
> > </div>
> > <div ID='layer1'><form name='form1'><input type='checkbox' name='a'
> value='avacado'>a</form></div>
> > <div ID='layer2'><form name='form2'><input type='checkbox' name='b'
> value='beer'>b</form></div>
> > <div ID='layer4'><form name='form3'><input type='checkbox' name='c'
> value='citra'>c</form></div>
> > <!--</div> -->
> > </body>
> >
> > tfyt
> $subst('Email.Unsub').
> 

  Return to Index