devxlogo

Netscape DIV Tags

Netscape DIV Tags

Question:
How do I make the contents of one DIV (divA) equal to the contents of another DIV (divB) in Netscape? I know that in Microsoft Internet Explorer the code would be

divA.innerHTML = divB.innerHTML

Thanks for your help.

Answer:
Unfortunately, there is no way to do what you want here. The Netscape 4.x DIV tags are considerably more primitive in their structure than the DIV tags used in Microsoft Internet Explorer, and even the LAYER tag doesn’t have the necessary interface to let you read the contents of an individual element. The closest solution that you can manage would be to write to both of the layers from the same source:

var myMessage="This is a test."document.layers["layerA"].write.document.write(myMessage);document.layers["layerB"].write.document.write(myMessage);

You should also note that Netscape does not have a translation mechanism for writing straight text to a layer–you can only write HTML. While this feature limitation is usually not a major factor, it can be important if you use escaped characters. If the text to be passed was a programming statement such as:

if (a

then Netscape will attempt to create a new tag called "". Since there is no closing bracket, the HTML parser will continue looking until it finds one (likely the closing bracket of the tag). This is guaranteed to give you something you didn't expect.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist