View Full Version : html-background image can't scroll down
Ka_yee_lam
09-02-2002, 05:41 PM
Dear All
I m learning to make a webpage. Hope you would pardon my silly question.
I would like to use a pic as my background. I wonder how can i make the page flexible for all screen size. The pic is quite big, so when I upload it to the web site, a 640x480 screen can only show part of it and the scroll bar is not available.
Would appreciate if someone can teach me the correct coding.
Many thanks in advance.
Quiet Storm
09-02-2002, 11:15 PM
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript">
<!--//
NS4 = (document.layers);
IE4 = (document.all);
scaleWidth = true;
scaleHeight = true;
imSRC = "your-image.jpg";
if (NS4) window.onload = setResize;
function setResize(){
setTimeout("window.onresize=reDo;",500);
}
function reDo(){
window.location.reload()
}
if (IE4) window.onresize = reDoIE;
function reDoIE(){
imBG.width = document.body.clientWidth;
imBG.height = document.body.clientHeight;
}
function makeIm() {
winWid = (NS4) ? innerWidth -1: document.body.clientWidth;
winHgt = (NS4) ? innerHeight -1: document.body.clientHeight;
imStr = "<DIV ID=elBGim" + " STYLE='position:absolute;left:0;top:0;z-index:-1'>" + "<IMG NAME='imBG' BORDER=0 SRC=" + imSRC;
if (scaleWidth) imStr += " WIDTH=" + winWid;
if (scaleHeight) imStr += " HEIGHT=" + winHgt;
imStr += "></DIV>"
document.write(imStr);
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript1.2">
makeIm();
</SCRIPT>
...the rest of your content here...
</BODY>
</HTML>
Check out my site for an example.
Ka_yee_lam
09-03-2002, 04:54 AM
:o THANK YOU VERY MUCH FOR YOUR QUICK ASSISTANCE AND RESPONSE. VERY MUCH APPRECIATE IT.
I wonder if you could advice some sources where I can learn more of the coding. Then I would not have to bother you too much. :D
THANK YOU SO MUCH AGAIN
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.