-
Netscape/IE hide/show DIV's
I have split a large registration page into 7 smaller ones, each in a Div
tag.
Each page has a next and back button. In the OnClick event for these
buttons I hide all DIV's and show the next page. This works fine in IE but
the DIV's won't hide in NETSCAPE, any idea's.
In IE I am using
<DIV ID="page01">
....
...
...<input type=button ID=button01 OnClick="gotoPage02();">
</DIV>
Then there are a number of Javascript functions, which are sort of messy but
work (in IE)
function gotoPage01 {
Page02.style.display = "none";
Page03.style.display = "none";
Page04.style.display = "none";
Page05.style.display = "none";
Page06.style.display = "none";
Page07.style.display = "none";
Page01.style.display = "none";
}
The other page have similar functions.
Any help would be appreciated.
-
Re: Netscape/IE hide/show DIV's
Use the visibility attribut and not the display attribute for crossbrowser code
as follows:
// SNIFFER
//////////////////////
IE4 = (document.all) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
VER4 = (IE4 || NS4) ? 1 : 0;
// LAYER definitions
// DEFAULT IE
/////////////////////
is_layref = "document.all";
is_laystyle = "layer.style.";
is_flip = ".style";
// NS
if (NS4)
{
is_layref = "document.layers";
is_laystyle = "layer.";
is_flip = "";
}
////////////////////////////////
// f_flip
// Purpose: To flip a layer
/////////////////////////////////
function f_flip(as_name)
{
var ls_visibility;
ls_visibility = "visible";
if (ib_visible) { ls_visibility = "hidden" ;}
ib_visible = !ib_visible;
f_visibility(as_name, ls_visibility);
window.status = ls_visibility;
}
////////////////////////////////////////
// f_visibility
// Purpose: To change layer's visibility
////////////////////////////////////////
function f_visibility(as_name, as_mode)
{
ls_eval = is_layref + '["'+ as_name +'"]' + is_flip + '.visibility="' +
as_mode + '"';
eval(ls_eval);
}
Chris Raethke wrote:
> I have split a large registration page into 7 smaller ones, each in a Div
> tag.
>
> Each page has a next and back button. In the OnClick event for these
> buttons I hide all DIV's and show the next page. This works fine in IE but
> the DIV's won't hide in NETSCAPE, any idea's.
>
> In IE I am using
>
> <DIV ID="page01">
> ...
> ..
> ..<input type=button ID=button01 OnClick="gotoPage02();">
> </DIV>
>
> Then there are a number of Javascript functions, which are sort of messy but
> work (in IE)
>
> function gotoPage01 {
> Page02.style.display = "none";
> Page03.style.display = "none";
> Page04.style.display = "none";
> Page05.style.display = "none";
> Page06.style.display = "none";
> Page07.style.display = "none";
>
> Page01.style.display = "none";
> }
>
> The other page have similar functions.
>
> Any help would be appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks