Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Works fine in IE6+ but not in NN6+ or Pheonix

Status
Not open for further replies.

JProg

Programmer
Apr 4, 2002
88
JP
Hello Everyone,

I like many people am being challenged by the cross-browser phenomena. Currently I have developed a script that centers page elements in the middle of the screen. The code works fine in IE6+. However when it is run in NN6+
and in Pheonix it doesn't work as expected by overlapping page elements. These same elements are being correctly placed with IE.

I have checked for errors in the JavaScript and NN6 cannot find anything obviously wrong with the code even though it doesn't display the page the way I would like it to. On the other hand in addition to not displaying as desired, the Pheonix browser lists the following concerns:

Error: setPrimaryElement is not defined
Source File: file:///F:/New%20FernGully%20Pages/Craft%20Stamps%20Templates/Version%202/html/CraftStampsTemplate.htm
Line: 36

Error: setSecondaryElement is not defined
Source File: file:///F:/New%20FernGully%20Pages/Craft%20Stamps%20Templates/Version%202/html/CraftStampsTemplate.htm
Line: 100

These two errors lead me to believe that I am not calling my script correctly from within the main html page. I am under the impression that IE6+ NS6+ and Pheonix all support an identical DOM, at least that is the result I obtain from running an object detection script.

The script I have created relies upon each page element being given a unique identifier. This I have achieved by using style sheets, the pertinent css info follows:

<style type="text/css">
#craftStampContainer
{
position: absolute;
height: 328px;
width: 322px;
}
#shoppingCartContainer
{
position: relative;
height: 500px;
width: 400px;
}
</style>

These styles are used to identify <div> elements that are dynamically positioned with the following calling functions.

<script language="javascript" type="text/javascript">
setPrimaryElement('craftStampContainer',328, 322, 1, "#ffffff");
</script>

<script language="javascript" type="text/javascript">
setSecondaryElement('shoppingCartContainer', 500, 400, 1, "#ffffff");
</script>

The information given in the calling function is:
* The page elements identifier
* The height of the page element
* The width of the page element
* The Z-Index of the element
* The background colour of the <div> page element

I figure that there must be a variation in the manner that NN and Pheonix deal with css or calling javascript from within an html page. However I am at a loss as to what is causing the odd behaviour. Any ideas will be greatly appreciated.

I have successfully tested a sister script to this on all browsers, the sister script successfully centers one page element on all of the afore mentioned browsers.

Thanks for your time

Regards

David
 

Are setPrimaryElement and setSecondaryElement actually defined anywhere? You've certainly not included them with the code here, so maybe that is your problem?

Dan

 
Dan,

The javascript functions that I mentioned have been defined in a seperate .js file. They appear to work fine for IE, but not for the others. I am not too concerned about fixing this script anymore, my older version works fine, so I am going to flow with that. Life's too short to spend frustrated hours in front of the computer, desperately trying to figure out why software companies just can't decide on a consistant DOM. Thanks for your suggestion though.

Kind Regards

David
 

Life's too short to spend frustrated hours in front of the computer, desperately trying to figure out why software companies just can't decide on a consistant DOM.

Most of the time it is shoddy coding that utilises non-standard, IE-only shortcuts that is to blame, rather than shoddy browsers.

Maybe if you took the time to post the relevant code, rather than teasing us with a post you had no intention of following up with, someone would be willing to help you out with it.

Dan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top