View Full Version : Hide/Show a div in Opera
Bosko
06-27-2002, 06:29 PM
How can I show/hide a DIV in Opera 6+?For Mozilla,Konqueror and IE its: document.getelementbyid("test").style.visibility="hidden";
Thanks in advance.
I always assumed that:
document.getElementById('nodeID').style.visibility = 'hidden';
Would work in Opera. Opera does not support any dynamica manipulations to the page's document structure, but I know you can hide/show nodes, as some menus work in Opera,
Perhaps using style.display = 'none' instead would work? Brothercake (a forum member) should know, as I believe he wrote a menu that works in Opera...
Graeme Hackston
06-27-2002, 10:16 PM
Try the script that Adios gave me in the link below (2nd last post). It works in Opera6 Win98 unless I change the style to display.
http://www.codingforums.com/ubb/Forum1/HTML/025905.html
brothercake
06-28-2002, 10:07 AM
Both display and visibility are supported by opera, and the getElementById technique is the right one.
It must be something else - can you show us the script.
Bosko
06-28-2002, 11:21 PM
I was trying to make the script I found on http://www.geocities.com/x_goose_x/tree/compiler.htm work in Opera6.It uses style.display but it doesnt work in Opera.
Graeme Hackston
07-03-2002, 01:02 AM
Thanks Brothercake.
It must be something else I'm doing.
brothercake
07-03-2002, 10:03 AM
Well maybe not actually - it appears I spoke to soon :rolleyes:
Playing with that script, I couldn't get it to work either, for no readily apparent reason, so I looked into Opera's JS specs http://www.opera.com/docs/specs/js/ and display doesn't appear; it doesn't say it isn't supported but it doesn't say it is either. Querying the obj.style.display returned undefined, so maybe display just isn't supported after all
sorry for any confusion ...
bassleader
07-03-2002, 06:35 PM
The menus on this site (CBS.SportsLine.com (http://www.cbs.sportsline.com/u/includes/script/mlb.htm)) work in Opera 6, so presumably it must be supported to some extent. All the code is embedded in the document, though I've not had a chance to study it yet (there's a lot of it).
I was always led to believe that Opera didn't support dynamic modification of pages, so I was pretty surprised when I came across this.
BL
Bosko
07-03-2002, 07:11 PM
Hmmmmm.......so should I just use visibility then instead of setting display to none?
brothercake
07-03-2002, 07:14 PM
Well this much is certain - dynamic modification of elements is not supported in Opera - that menu you linked to uses visibility, which is not the same thing as display.
Visibility is supported in Opera - check out http://www.brothercake.com/dropdown/ in opera to see how it can be used to make a menu system - but for a collapse/expand style nav then display would be needed, so it may not (probably wont) work in Opera. I'll do some tests and confirm support/lack of support for this property shortly
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.