Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Cross Browser Issues
Expertise: Beginner
Nov 5, 1999



Dynamic Content Using Radio Buttons


I wrote JavaScript code that displays different text depending on the radio button clicked. I used innerHTML to display text, which works fine on Internet Explorer 5 but not on Netscape 4.6. What should I do?


A somewhat equivalent technique to use with Navigator 4.x is a combination of document.write and document.close. However, this will only work with layer type objects—objects defined using the LAYER tag (don't use this), or content contained in positioned DIV or SPAN blocks. To replace contents, use something similar to this code (if you've attached an identifier of "test" to the block):



"); document.test.document.close();

Navigator creates a new document object for each layer, and document supports the write method to create the document's contents. The close method then forces a redraw. One area where innerHTML and document.write differ is that document.write does not preserve any CSS styling for the block.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date