Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can JavaScript be used to remove part of an HTML page? 1

Status
Not open for further replies.

rzward

Programmer
Nov 6, 2002
38
US
Hello,

Is it possible to use JavaScript or some other browser-side scripting language to remove (as opposed to make invisible) part of an HTML page?

I am familiar with making part of an HTML page invisible by using layers and setting the visibility property to "hidden" or "hide", depending on the browser. However, making part of an HTML page invisible leaves the area blank. I'm looking to have the area that follows move up so it doesn't look like there's a blank space.

If you would like to see an example of making part of an HTML page invisible, you can visit:


Any ideas would be greatly appreciated.

Richard
 
Instead of using visibility:hidden, you can use display:none to hide and display:block to show it again. This moves the rest of the content to fill the space.

 
Of course, that was CSS way. Javascript way is display="none"
 
Thank you HellTel!

This works well on IE 6, but not on NS 4.x nor NS 6.x. I've searched but have not yet found information about how to do it for NS. Any ideas where I can read about how/or if NS can do this too?

Richard
 
you can use document.getElemenById("id").style.display = "none" in Mozilla 1.0, Netscape 6+, IE5+.

Netscape 4 is useless and only about 2% of the net still uses it. Don't spend time trying to support it. It cannot even do display properly! Gary Haran
 
Thank you xutopia,

I got NS 6 and IE 5+ to work fine using the getElementById("id").style.display method and struggled a great deal on Netscape 4 and may very well give up on that.

I found that the visible/invisible feature only works on NS 4 if the div or span tag has style="position:absolute;". There's probably some magic style setting that suddenly makes NS 4 work with display="none" as well, but I don't expect to find it...

Richard
 
rzward,

Netscape 4 is only a very small fraction that is fast dwindling to oblivion. I do recommend you forget about trying to support it.

Display freature does not work in NS4. Mostly everything is diferent when it comes to referencing elements with it. Forget about it.

Check out the stats I use for browser shares :

Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top