Click to See Complete Forum and Search --> : Page Loading


BLarrabee
05-29-2003, 09:52 PM
A simple question - I feel stupid posting it .. can anyone help me with proper language (I'm assuming Javascript?) for automatically loading an 'htm' page residing locally? Based upon screen resolution, I'd like to have certain pages automatically load without the need to "click on a link." I have the javascript code to determine screen resolution, but I'd like to automatically load the proper page associated with the screen resolution in use by the user.

Thanks ...

Bruce Larrabee
BLarrabee47@aol.com

Jona
05-29-2003, 09:57 PM
Instead of me making a whole script for you, just post the script you have already so that I can modify it.

Jona

BLarrabee
05-29-2003, 10:05 PM
Below is the script I have .. you can seen that I've tried a few things ... the first "if" requires clicking a link which I'd prefer not having to do ...


if (screen.height >= 768 && screen.width >= 1024) {
document.write("<a href='backtesth.htm'><img src='amb10x12.jpg'>backtest</a>");
}
else {
if (screen.height == 600 && screen.width == 800) {
document.write("default3.htm");
}
else {
document.write("<img src='amberh278.jpg' width=475 height=400 border=0>");
}
}

Jona
05-29-2003, 10:09 PM
<script type="text/javascript">
<!--
/*Redirection does not need an onload event, because this script is in the <head> tag, so you will automatically go to another page as soon as this Javascript is loaded--which is before the rest of the page.*/

if(screen.height >= 768 && screen.width >=1024){
location.href="large_page.htm";
} else if(screen.height == 600 && screen.width == 800){
location.href="medium_page.htm"; //this is the most common resolution
} else {
location.href="small_page.htm";
}
//-->
</script>


Jona

pyro
05-29-2003, 10:10 PM
Try it something like this:

if (screen.height >= 768) {
window.location.href="backtesth.htm";
}
else if (screen.height == 600) {
window.location.href="default3.htm";
}
else {
document.write("<img src='amberh278.jpg' width=475 height=400 border=0>");
}