Sign in to follow this  
agm_ultimatex

[web] Cross browser problem using layers

Recommended Posts

I currently have a layer created in an ASP string, and then sent into an iframe tag via javascript. It contains a couple labels, a couple select boxes and a submit button. When I open the layer via hyperlink in the webpage(using IE 7). The labels are invisible (like if they were coloured the same as the background). When I highlight them they appear partially, and dissappear if i highlight the whole layer and a bit of the page. However, it renders completely fine in firefox. Any help on this would be appreciated.

Share this post


Link to post
Share on other sites
I'll use simple filenames just for reference.

The asp code that creates the layer content (such as text boxes) (file2.asp):

If Request.QueryString("type") = 2 Then
LayerContent = LayerContent & "<p style=\'font-weight:bold\'>Create Knowledge Asset</p><div><span>Asset Name:</span><br /><input type=\'text\' name=newka /></div>"
LayerContent = LayerContent & "<div style=\'padding-top:10px;\'><span>Category Type: </span><br /><select name=kacatname><option value=0>Please Choose&hellip;</option>"
Set oRs2 = oConn.Execute("SELECT kacatID, kacatshort, kacatlong, kacatorder FROM kacat WHERE kacatownerid="& CurrentOwnerID &" ORDER BY kacatorder")
Do While Not oRs2.EOF
LayerContent = LayerContent & "<option value="& oRs2(0) &">"& oRs2(1) &"</option>"
oRs2.MoveNext
Loop
LayerContent = LayerContent & "</select></div><div style=\'padding-top:10px;\'><label>Date Type:</label><br /><select name=dateflag>"
Set oRs3 = oConn.Execute("SELECT codeID, codetypeid, codedesc, codeorder, codevalue FROM codes WHERE codetypeid = 6 AND codeownerID="& CurrentOwnerID &" ORDER BY codeorder")
Do While Not oRs3.EOF
LayerContent = LayerContent & "<option value="& oRs3(4) &">"& oRs3(2) &"</option>"
oRs3.MoveNext
Loop
LayerContent = LayerContent & "</select></div><div style=\'padding-top:10px;\'><input type=submit name=action value=\'New\' />&nbsp;<input type=button onClick=HideContent(\'createcategory\') value=Cancel /></div></div></body></html>"
End If



A bit of javascript calling following that in the same page:

<body style="font:Courier;" onload="javascript:parent.document.getElementById('createcategory').innerHTML = '<% = LayerContent %>'; parent.ShowContent('createcategory');return true;">
</body>



The javascript functions that are used for the layer(file1.asp - which is the page that the link is on to open the layer): (I didn't write it, my boss did, and used it on a previous web app. The two last arithmetic statements i changed to static variables so the layer would pop up in one place rather than where the mouse position is).

function HideContent(d) {
if(d.length < [1]) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < [1]) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < [1]) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
var cX = [0]; var cY = [0]; var rX = [0]; var rY = [0];
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
rX = self.pageXOffset;
rY = self.pageYOffset;
}
else if(document.documentElement && document.documentElement.scrollTop) {
rX = document.documentElement.scrollLeft;
rY = document.documentElement.scrollTop;
}
else if(document.body) {
rX = document.body.scrollLeft;
rY = document.body.scrollTop;
}
if(document.all) {
cX += rX;
cY += rY;
}
d.style.left = ([0]) + "px";
d.style.top = ([150]) + "px";
}



Then I use a div that has the id of createcategory and an iframe with the name contentFRM, which is targeted via the hyperlink. Both are in file1.asp

Also notice the asp statement If Request.QueryString("type") = 2 Then
theres another if above that where its = to 1. That generates different content for a different purpose, and works fine.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this