IE css issue with dynamic js positioning and display properties

Nevraeka
avatar
rank newbie

newbie


Posts: 3
Joined: 2008-04-25

I have created a page that validates a form in Javascript and displays two elements on top of the page. One to lock the site out, and one to show errors and a continue button. Unfortunatley ie sucks. It won't even fire ythe javscript. No errors appear in ff firebug, yet in explorer 6+ I get 3 errors. Please help.

html (jsp)

Validate

The following items need to be updated in order to continue with your checkout

CSS:

#errorDiv {padding:20px;width:330px;width:expression(370);height:190px;height:expression(230);border:solid 1px #c00;background-color:#fff;position:fixed;display:none;z-index:600;top:50%;left:50%;margin-left:-185px;margin-top:-115px;}
div#blackBkg {width:100%;height:1024px;position:fixed;top:0px;left:0px;display:none;z-index:500;background-color:#000;filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;}

Javascript:
function validateRegistration()
{
                //validation for items went here (removed for brevity)
openDiv();
}
function openDiv()
{
if(document.getElementById("errorList") != "")
{
if(navigator.appName.indexOf("Microsoft")!=-1)
{
document.getElementById("blackBkg").style.display = (document.getElementById("blackBkg").style.display == 'inherit')? '' : 'inherit';
document.getElementById("errorDiv").style.display = (document.getElementById("errorDiv").style.display == 'inherit')? '' : 'inherit';
}
else
{
document.getElementById("blackBkg").style.display = "inherit";
document.getElementById("errorDiv").style.display = "inherit";
}
}
}
function clearError()
{
document.getElementById("blackBkg").style.display = "none";
document.getElementById("errorDiv").style.display = "none";
}

//mod edit: This seems to be primarily a javascript issue. Moved to "off topic"
--gary

gary.turner
gary.turner's picture
rank Moderator

Moderator


Posts: 5645
Joined: 2004-06-25
Location: Dallas

I seldom (OK, I can't

I seldom (OK, I can't remember ever) use IE's expression function, but your syntax does not look right. You'll need to concatenate the metric value if nothing else.

cheers,

gary

A pianist who has learned the wrong system of fingering cannot become a virtuoso until he has laboriously taught himself the proper method.

My site is slo-o-owly being reconstructed; visit anyway.

Nevraeka
Nevraeka's picture
rank newbie

newbie


Posts: 3
Joined: 2008-04-25

ie issue

Thanks for the reply. I use expression sometimes to fix the padding issues that occur in ie. When you say 'concatenate the metric value', what exactly are we talking about. Also, I am wondering if position:fixed could be causing this. I need to have the error message always be centered in the window and the semi-transparent background there so that the user must respond to the message first but they can still see the objects behind it. I am trying to aviod popups and message boxes if I can. Thanks.

gary.turner
gary.turner's picture
rank Moderator

Moderator


Posts: 5645
Joined: 2004-06-25
Location: Dallas

Since there are no

Since there are no calculations involved, I'd think using expression would be a poor solution; especially as only IE5 needs correction for the box model. I'm assuming you're using a complete DTD to trigger standards mode in IE6/7.

The returned value should be a string, eg. {width:expression("320px");}. Don't take my word for it, though, because I wouldn't do it that way, and haven't become overly familiar with the method.

cheers,

gary

A pianist who has learned the wrong system of fingering cannot become a virtuoso until he has laboriously taught himself the proper method.

My site is slo-o-owly being reconstructed; visit anyway.