SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard davidjmedlock's Avatar
    Join Date
    Dec 2002
    Location
    Nashville, TN USA
    Posts
    1,688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    anyone know how to do this?

    Okay, so I'm working on a project that currently works in IE 5.5 & up and NS 6 and up. But, it's a possibility that it will have to work on NS 4.7. I've been trying to make it work in NS 4 just in case, since I don't want to back track.

    I'm using javascript to build a breadcrumb trail and I simply need to know how to get the existing text out of a layer in NS 4.7. I know how to write to a layer:

    Code:
      <layer id="test">Test</layer>
      <script language="javascript" type="text/javascript">
    	 document.layers['test'].document.write("Overwrite text");
    	 document.layers['test'].document.close();
      </script>
    But, I need to append text to what currently exists in the layer. Anybody got ideas? (And yes, I've searched the forums as well as Google and Netscape extensively. That's why I'm posting. )

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure myself - though IMO I'd forget all about NS4.x as this browser is dead and buried.

    Anyway, I've attached a PDF file that basically covers all sorts of navigation using Javascript; maybe there is a solution in there for NS4.x ?

    Have a look anyway - wouldn't do any harm looking as I see it, but as for NS4.x I just wouldn't make the effort really.

  3. #3
    SitePoint Wizard davidjmedlock's Avatar
    Join Date
    Dec 2002
    Location
    Nashville, TN USA
    Posts
    1,688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish I could forget about NS 4, since it really is dead, but unfortunately, our application has to work on many different platforms, including NS 4.x on a Mac.
    (This is because of various problems with Windows Media Player working in different browsers and OS's. Also, we have many corporate and gov't clients that have different system requirements that our content delivery system has to work with.)

    I'll check out the PDF, though. Thanks!

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Navigator layers are miniature windows, each with their own document inside; since NS4 doesn't expose document contents through their overall object model, don't hold your breath looking for readable Layer.document content either. No 'innerHTML' in sight here. The solution, as with so many other shortcomings in this browser: roll your own. Set a loop, run onload, that creates an .innerHTML property for each layer object:

    var NS4_innerHTML = new Array();
    NS4_innerHTML[0] = '...............';
    NS4_innerHTML[1] = '...............'; ...etc.

    for (var l, i=0; i<document.layers.length; ++i) {
    l = document.layers[i];
    l.innerHTML = NS4_innerHTML[i];
    }

    Then just construct the necessary code to read/write/update the custom property. Don't even ask about nested layers. I used to have an API for this (using the watch() method for event-driven updates), but I chucked it months ago, along with the time wasted on such foolishness. You have my sympathy.

  5. #5
    SitePoint Wizard davidjmedlock's Avatar
    Join Date
    Dec 2002
    Location
    Nashville, TN USA
    Posts
    1,688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm, well, I think that I got it figured out. Instead of trying to append HTML to what is currently existing, I'm just going to write everything out at once. There's absolutely no performance issues to really worry about. It's just a matter of getting these things to keep their formatting when I modify the HTML. That's a different story, though.

    BTW, for nesting layers, you reference them with:

    document.layer['layer1'].document.layer['layer1a'].document.write()

    etc.

  6. #6
    SitePoint Addict
    Join Date
    May 2003
    Location
    The Netherlands
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's indeed the only way you may add some content to a NS4 layer.

    function NSInnerHTML(parentname,name,content){
    var myNSLayer=eval("document.layer['"+name+"'].document");
    if (parentname) {myNSLayer=eval("document.layer['"+parentname+"'].document");}
    myNSLayer.open();
    myNSLayer.write(content);
    myNSLayer.close();
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •