Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: visible and hidden NN IE


Message #1 by Dimitriy Dribinskiy <DimitriyD@M...> on Mon, 24 Sep 2001 14:56:32 -0400
You can solve this problem with nn4 in two ways:
1) Define all text blocks as absolutely positioned element and reposition 
them on the onchange event.

2) Create a container layer and rewrite all content on the onchange event 
(document.open; document.write; document.close).

eelco

> Hello
> Could you please help me. This page works fine in IE. But not in NN4. Div
> 'p1' should be not visible onLoad and visible only when option3 selected.
> Also, I need to keep no space between lines 'Some text' and 'Some other
> random text'when 'p1' is hidden
> 
> Tank you
> Dmitriy
> 
> 
> 
> <HTML>
> <HEAD>
> <TITLE>DHTML Mouseover</TITLE>
> <STYLE TYPE="text/css">
> DIV.class1 
> {
>     position:relative;
>     BACKGROUND-COLOR: #ffcc00;
>     COLOR: black;
>     FONT-FAMILY: arial, garamond;
>     FONT-SIZE: 8pt;
>     FONT-WEIGHT: normal
> }
> DIV.clFormnotab
> {
>     LEFT: 150px;
>     POSITION: absolute;
>     TOP: 145px;
>     Z-INDEX: 3
> }
> FONT.errorhead
> {
>     BACKGROUND-COLOR: #ffcc00;
>     COLOR: black;
>     FONT-FAMILY: Arial, Verdana;
>     FONT-SIZE: 9pt;
>     FONT-WEIGHT: bold;
>     PADDING-LEFT: 10px
> }
> FONT.error
> {
>     BACKGROUND-COLOR: #ffcc00;
>     COLOR: black;
>     FONT-FAMILY: arial, garamond;
>     FONT-SIZE: 8pt;
>     FONT-WEIGHT: normal
> }
> TABLE.error
> {
>     BACKGROUND-COLOR: #ffcc00;
>     BORDER-BOTTOM: #ffcc00 10pt solid;
>     BORDER-LEFT: #ffcc00 10pt solid;
>     BORDER-RIGHT: #ffcc00 10pt solid;
>     BORDER-TOP: #ffcc00 10pt solid;
>     MARGIN: 5pt;
>     PADDING-BOTTOM: 10px;
>     PADDING-LEFT: 10px;
>     PADDING-RIGHT: 10px;
>     PADDING-TOP: 10px
> }
> </STYLE>
> <SCRIPT LANGUAGE = "JavaScript">
> var ie4 = (document.all) ? true : false;
> var ns4 = (document.layers) ? true : false;
> var ns6 = (document.getElementById && !document.all) ? true : false;
> function hideLayer(lay) {
> 	if (ie4) {document.all[lay].style.display = "none";}
> 	if (ns4) {document.layers[lay].visibility = "hide";}
> 	if (ns6) {document.getElementById([lay]).style.display = "none";}
> }
> function showLayer(lay) {
> 	if (ie4) {document.all[lay].style.display = "";}
> 	if (ns4) {document.layers[lay].visibility = "show";}
> 	if (ns6) {document.getElementById([lay]).style.display = "block";}
> }
> 
> 
> function changeObjectAppearance(object1)
> {
>     
>     if(document.PoeticWebForm.selectname.selectedIndex == 2)
> 		showLayer(object1)
>     else
>       hideLayer(object1)
> }
> </SCRIPT>
> </HEAD>
> <BODY BGCOLOR=#FFFFFF onLoad=hideLayer('p1')>
> 
> <DIV class="clFormnotab">
> <form name="PoeticWebForm">
>             <select name="selectname" onchange 
> "changeObjectAppearance('p1')">
>             <option>case 1</option>
>             <option>case 2</option>
>             <option>case 3 - Disappear !</option>
>             <option>case 4</option>
>             </select>
> <BR>
> Some text
> <DIV class="class1" ID="p1" name="p1"> 
> <BR>
> <table width="550" class="error" border="0">
> 		<tr><td><font class=errorhead>Error!</font></td></tr>
> 		<tr><td><font class=error><b>.</b> Example: Dynamicly
> displaied/not displaied text</font></td></tr>
> </table>
> </DIV>
> 
> 
> <BR>
> Some other random text
> 
> 
> </form>
> </div>
> </BODY>
> </HTML>
> 
> 

  Return to Index