
June 13th, 2001, 07:18 PM
|
|
Senior Citizen
|
|
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019
Time spent in forums: < 1 sec
Reputation Power: 15
|
|
|
The background image property isn't exposed in Navigator 4 (except through HTML). The references to style objects have to do with JSS (Javascript Style Sheets), which is just an alternative way of applying style rules before the document is rendered. Afterwards, you're principally limited, as you guessed, to Layer manipulation. Try this:
immediately after the <body> tag:
<layer id="BGLayer" width="100%" height="100%" pageX="0" pageY="0" z-index="1" visibility="hide">
call this on/after load:
function setDocBG(sImgSrc) {
if (document.layers && document.BGLayer) {
var BG = document.BGLayer;
var BG_width = (window.innerWidth>document.width) ? window.innerWidth : document.width;
var BG_height = (window.innerHeight>document.height) ? window.innerHeight : document.height;
BG.resizeTo(BG_width,BG_height);
BG.background.src = sImgSrc;
BG.visibility = 'show';
} else if (document.body) {
document.body.background = sImgSrc;
}
}
convenience function to alter BG:
function changeDocBG(sImgSrc) {
if (document.layers && document.BGLayer) {
document.BGLayer.background.src = sImgSrc;
} else if (document.body) {
document.body.background = sImgSrc;
}
}
Pass a null string to eliminate the image BG entirely (exposes the bg color).
hth, adios
Last edited by adios : June 20th, 2001 at 05:58 PM.
|