PDA

View Full Version : if you undrstand cascading style sheets: will you help me?


julieA
01-28-2005, 11:15 AM
What would this do? It is in a javascript.js file for my index page to sterlington-la.com and I'm buying the design (I didn't write it) so I'm trying to figure out what all the files do in case I ever need to adjust the pages.

<!-- /* FULL BACKGROUND */

function fixBgImage() {
if (document.all.backgroundPic.style.setExpression) {
document.all.backgroundPic.style.setExpression("height","document.all.MainTable.offsetHeight");
document.recalc();
}
}
ie5 = (document.all && document.getElementById && !document.fireEvent)?true:false;
ie55= (document.all && document.fireEvent && !document.createComment)?true:false;
ie6 = (document.all && document.fireEvent && document.createComment)?true:false;
if (!window.opera && (ie5 || ie55 || ie6)) onload=fixBgImage;

// -->

julieA
01-28-2005, 11:54 AM
It appears to me to write html-using the information from the style specified in the line of the css which I show below- to display the background image so that it will stretch under certain circumstances.

#backgroundPic { z-Index:0; position:absolute; display:block; left:0%; top:0%; width:100%; height:100%; }

kitchin
01-28-2005, 01:36 PM
Try adding
alert(document.all.MainTable.offsetHeight)
in the function as a debug.
Probably changes height from 100% to a numeric value?

SetExpression is documented here:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setexpression.asp

oacis
01-28-2005, 03:47 PM
The last four lines try to determine the browser that is requesting the page. If the requesting browser is IE 5 or above AND it is NOT Opera then the onload event handler for the page is set to fixBgImage. This means that fixBgImage will be run when page loading is complete.

fixBgImage sets the height of object backgroundPic to be the same as the offsetHeight of MainTable. The offsetHeight property is an IE-specific property that includes the border, padding, and content area of the object - in this case MainTable.

Does this make sense based on what you know?

--

Wayne

julieA
02-09-2005, 09:01 AM
Yes. But I only recently began to THINK about other web browsers - which is pretty stupid for someone operating a website even as a hobby. I mean I knew there were others but I just let it slide out of my brain so I wouldn't have to act on the information and adjust my websites accordingly. Basically I've been driving the car and acting like it didn't matter if I knew anything about the engine- much less perform maintenance on the darn thing. But I resolve to LEARN this year- more. Obviously I won't be able to understand it all....and it is just a hobby for now...