Web Analytics Made Easy -
StatCounter New layers definition in NS4 using Javascript - CodingForum

Announcement

Collapse
No announcement yet.

New layers definition in NS4 using Javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • New layers definition in NS4 using Javascript

    Hello, I need help urgently !!!
    How to define in NS4 new layers using Javascript only, i.e. without "div" or "layer" commands
    in html body ? could you please send an answer
    to my email also : [email protected]
    or you can explain why this example is not working ?

    thank you very much

    function x()
    {
    var LR = document.layers["id"]=new Layer(100);
    LR.name= "id";
    LR.left= 100;

    LR.top = 96;
    LR.clip.height=13;
    LR.visibility='show';
    LR.zIndex=1;
    LR.bgColor=red;

    }

  • #2
    var myLayer = new Layer(200, window);

    That creates a top-level layer 200px wide.

    Then you modify it through the reference of myLayer. The second argument I believe is optional, and defaults to window if not specified. You can also provide references to other layer objects as the second argument, and the layer you are creating becomes a child of it.
    jasonkarldavis.com

    Comment


    • #3
      But this example is not working.

      It is not comming to the alert !

      <html>
      <script language="Javascript1.2">
      function x()
      {
      var myLayer = new Layer(200, window);
      alert('test');
      }
      </script>
      <body>
      <script language="Javascript1.2">
      x();
      </script>
      </body>
      </html>

      Comment


      • #4
        http://developer.netscape.com/docs/m...33.htm#1070570

        That says you can *only* use new Layer() AFTER the page has loaded.
        jasonkarldavis.com

        Comment

        Working...
        X