Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please help me with NN 4.x problem

1 view
Skip to first unread message

Manish

unread,
Aug 2, 2001, 3:49:04 PM8/2/01
to
I am having a problem in displaying some text and FORM in a layer in
Netscpe(4.7).
In short I want to display a dialog box like confirm, alert etc.
The code works as desired in Netscape 6.0 and IE.
But it's NN4.x which is giving me several problems in the formatting of
the layer.
Checked Netscape's DHTML document, the CSS seems OK.
I have tried everything and have almost given up, but I want to make it
work in these three browsers.
Please help me, I'll be obliged.

The main problems I am having with my NN4.7 browser are -
1) It won't obey width attribute of css.
2) Weird padding and margin in the layer.
3) Border(style:outset) around the layer is not being displayed, I have
also tried solid, but no luck.
4) Also whenever I use class for a Button, the buttons are displayed on
separate lines in Netscape 4.x, so I have commented that code in CSS.
How can I prevent this?

Here is the code -

=============================================================================

<html>
<head>
<style>
<!--
.dlg {color:#000000; background-color:#D4D0C8;
layer-background-color:#D4D0C8; position:absolute; left:100px;
top:200px; width:300px;
padding-left:1px; padding-right:1px; padding-top:1px;
padding-bottom:1px;
border-width:2px; border-style:outset; visibility:hidden;
z-index:999;}

/* .dlgbutton {margin-left:5px; margin-right:5px; padding-left:5px;
padding-right:5px;} */

.dlgtext {padding-left:10px; padding-right:10px; border:0px;}

.dlgtitle {color:#ffffff; background-color:#000080;
layer-background-color:#000080; font-weight:bold;
margin-top:1px; margin-bottom:10px; margin-left:1px;
margin-right:1px; border:none;}

-->
</style>
<title> Custom Dummy Dialog </title>
<script type="text/javascript" language="JavaScript">
<!--
var brw = navigator.appName;
var ver = parseInt((navigator.appVersion).charAt(0));

var szDlgResult = "";
var szContents ="";

var szArray = new Array();
szArray[0] = "Yes";
szArray[1] = "No";
szArray[2] = "Cancel";

function toggleDialog(szState)
{
if('Netscape' == brw && ver < 5)
{
document.layers["DlgBox"].visibility = ("Visible" == szState) ?
"show" : "hide";
}
else if('Netscape' == brw && ver >= 5)
{
var obj = document.getElementById("DlgBox");
obj.style.visibility = szState;
}
else // IE
{
document.all["DlgBox"].style.visibility = szState;
}
}

function createDialog(szTitle, szMessage, szLabelArray)
{
toggleDialog('Visible');
//create all components of dialog box
szContents = '<div class="dlgtitle">&nbsp;&nbsp;' + szTitle
+'<\/div>\n';

szContents += '<div class="dlgtext">' + szMessage + '<\/div>\n'
szContents += '<br><br>\n';

szContents += '<form name="DlgForm">\n<center>\n';

for(i=0; i< szLabelArray.length; i++)
{
szContents += '&nbsp;<input type="button" class="dlgbutton" value="'
+ szLabelArray[i] + '" onClick="clickDialog(this);"> &nbsp;\n';
}
szContents += '<\/center>\n<\/form>\n';

//alert(szContents); //see if the contents are proper and valid
if ('Netscape' == brw && ver < 5)
{
document.layers['DlgBox'].document.open();
document.layers['DlgBox'].document.write(szContents);
document.layers['DlgBox'].document.DlgForm.elements[0].focus();
document.layers['DlgBox'].document.close();
}
else if('Netscape' == brw && ver >= 5)
{
var obj = document.getElementById("DlgBox");
obj.innerHTML = szContents;
document.DlgForm.elements[0].focus();
}
else if (document.all) //IE
{
document.all["DlgBox"].innerHTML = szContents;
document.DlgForm.elements[0].focus();
}


}


function clickDialog(objButton)
{
toggleDialog('Hidden');
szDlgResult =objButton.value;
handleDialog(); //don't poll me, I'll call you
//return objButton.value;
}

function handleDialog()
{
/* This is the handler of the dialog
put functionality you want on particular button clicked here
*/

if(szArray[0] == szDlgResult)
{
alert(szDlgResult);
self.close();
}
else
{
alert(szDlgResult);
}
}


// -->
</script>
</head>
<body>
<div id="DlgBox" class="dlg">
Initial Text
</div>
Line 1<br>
Line 2<br>
Line 3<br>
Line 4<br>
<form>
<input size="20" type="text" value="12345">
</form>
<a href="JavaScript:createDialog('Are you sure?', 'Do you want to close
the browser window?', szArray); void 0">
Show Dummy Dialog
</a>
</body>
</html>

==========================================================================================

Thanx,
- Manish


Martin Honnen

unread,
Aug 3, 2001, 6:57:01 AM8/3/01
to
Try using a table on which you set width and height as needed. Use a
nested table to have some border effect

--

Martin Honnen
http://javascript.faqts.com/
http://home.t-online.de/home/martin.honnen/jsgoddies.html


Manish

unread,
Aug 5, 2001, 10:23:09 AM8/5/01
to
Tried. No luck :((
Is it a known bug with NN4.x?
Don't know what else can be done...

- Manish


"Martin Honnen" <Martin...@t-online.de> wrote in message
news:3B6A837D...@t-online.de...

Sergey Snovskiy

unread,
Aug 7, 2001, 2:17:45 PM8/7/01
to
Look at this page:

http://www.useractive.com/learning/dhtml/dhtmltut5.php3

They talk about Netscape 4 not getting the box properties right, and offer some
fix...

Sergey

Manish

unread,
Aug 7, 2001, 2:31:42 PM8/7/01
to
Thanx!!!
That was quite helpful. Will try those tips.....

- Manish


"Sergey Snovskiy" <se...@sdci.net> wrote in message
news:3B7030C9...@sdci.net...

0 new messages