I'm working on my site, and I was wondering if there's anyway that I can stretch my background image. Here's the code that I've tried, and unfortunately, it's not working.. Maybe I'm missing something, take a look..
<pre>
<body link="#808000" vlink="#808000" alink="#808000" text="#FFFFFF" bgcolor="#002E5B" topmargin="0" leftmargin="0">
<DIV ID="bgimage" style="position:absolute;visbility:hidden">
<script LANGUAGE="JavaScript">
<!--
// add the URL of your image
var myImage="file://C:My FilesMy Homepagebackground.jpg"
// do not edit the variables below
var preload_myImage=new Image()
preload_myImage.src=myImage
function stretchimage() {
if (document.layers) {
var screenwidth=window.innerWidth
var screenheight=window.innerHeight
document.bgimage.document.write("<img src="+myImage+" width="+screenwidth+" height="+screenheight+">")
document.bgimage.document.close()
document.bgimage.left=0
document.bgimage.top=0
document.bgimage.visibility="visible"
}
if (document.all) {
var screenwidth=document.body.clientWidth
var screenheight=document.body.clientHeight
bgimage.innerHTML="<img src="+myImage+" width="+screenwidth+" height="+screenheight+">"
document.all.bgimage.style.posLeft=0
document.all.bgimage.style.posTop=0
document.all.bgimage.style.visibility="visible"
}
}
//-->
</script>
</div>
</body></pre>
Question
configure Veteran
Hi :p
I'm working on my site, and I was wondering if there's anyway that I can stretch my background image. Here's the code that I've tried, and unfortunately, it's not working.. Maybe I'm missing something, take a look..
Link to comment
Share on other sites
5 answers to this question
Recommended Posts