soup4you2
August 29th, 2003, 09:31
While trying to think of a way in HTML to stretch a background to a persons screensize i finally came up with something... thought i would share it since all the stuff i found on google just would not work...
[code:1:0502e53140]
<SCRIPT LANGUAGE="JavaScript">
var ScrnSize = "UnCommon"
ScrnSize = screen.width + "";
switch(ScrnSize) {
case "640": document.write('<body background="/gfx/bg640.jpg" BGPROPERTIES="fixed">');
case "800": document.write('<body background="/gfx/bg800.jpg" BGPROPERTIES="fixed">');
case "1024": document.write('<body background="/gfx/bg1024.jpg" BGPROPERTIES="fixed">');
case "1152": document.write('<body background="/gfx/bg1152.jpg" BGPROPERTIES="fixed">');
case "1280": document.write('<body background="/gfx/bg1280.jpg" BGPROPERTIES="fixed">');
case "1600": document.write('<body background="/gfx/bg1600.jpg" BGPROPERTIES="fixed">');
case "1920": document.write('<body background="/gfx/bg1920.jpg" BGPROPERTIES="fixed">');
case "2048": document.write('<body background="/gfx/bg2048.jpg" BGPROPERTIES="fixed">');
default: document.write('<body background="/gfx/bg1024.jpg" BGPROPERTIES="fixed">');
}
</script>
[/code:1:0502e53140]
Take diffrent backgrounds that way a person w/ a small screen doesnt have to load the big pictures
[code:1:0502e53140]
<SCRIPT LANGUAGE="JavaScript">
var ScrnSize = "UnCommon"
ScrnSize = screen.width + "";
switch(ScrnSize) {
case "640": document.write('<body background="/gfx/bg640.jpg" BGPROPERTIES="fixed">');
case "800": document.write('<body background="/gfx/bg800.jpg" BGPROPERTIES="fixed">');
case "1024": document.write('<body background="/gfx/bg1024.jpg" BGPROPERTIES="fixed">');
case "1152": document.write('<body background="/gfx/bg1152.jpg" BGPROPERTIES="fixed">');
case "1280": document.write('<body background="/gfx/bg1280.jpg" BGPROPERTIES="fixed">');
case "1600": document.write('<body background="/gfx/bg1600.jpg" BGPROPERTIES="fixed">');
case "1920": document.write('<body background="/gfx/bg1920.jpg" BGPROPERTIES="fixed">');
case "2048": document.write('<body background="/gfx/bg2048.jpg" BGPROPERTIES="fixed">');
default: document.write('<body background="/gfx/bg1024.jpg" BGPROPERTIES="fixed">');
}
</script>
[/code:1:0502e53140]
Take diffrent backgrounds that way a person w/ a small screen doesnt have to load the big pictures