Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Design Forum > HTML / CSS
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-12-2007, 03:58 PM   #1 (permalink)
Jako
Junior Member
 
Join Date: Jan 2007
Posts: 9
Default Plz help to solve my js problem

I have a redirect script that i got from the internet written by fjhdehoog which i need slightly adjusting but i do not know how to.

Here is the script.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My Web Page</title> <script type="text/javascript"> <!-- Begin /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: fjhdehoog :: http://members.home.nl/fjhdehoog */ var thiswidth=screen.width; var thisheight=screen.height; // file to load if resolution is 640x480: var if640x480 ="index640x480.html"; // file to load if resolution is 800x600: var if800x600="index_800x600.html"; // file to load if resolution is 1024x768: var if1024x768="index_1024x768.html"; // file to load if resolution is 1152x864: var if1152x864="index_1152x864.html"; // file to load if resolution is 1280x720: var if1280x1024="index_1152x864.html"; // file to load if resolution is greater than 1280x720: var Redirect ="http://www.google.co.uk"; var msg="Sorry my page cannot be viewed with current resolution.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Set your resolution to 800 x 600.\nRedirecting to google.com"; location=(Redirect); // Do not change anything below this line // -------------------------------------- var width1 = 640; var height1 = 480; var width2 = 800; var height2 = 600; var width3 = 1024; var height3 = 768; var width4 = 1152; var height4 = 864; var width5 = 1280; var height5 = 1024; if (screen.width == width1 || screen.height == height1){ alert(msg);} else if(screen.width == width2 || screen.height == height2){ location=(if800x600);} else if(screen.width == width3 || screen.height == height3){ location=(if1024x768);} else if(screen.width == width4 || screen.height == height4){ location=(if1152x864);} else if(screen.width == width5 || screen.height == height5){ location=(if1280x1024);} else if(screen.width >= width5 || screen.height >= height5){ alert(msg); } //--> </script> <!-- Script Size: 2.05 KB --> </head> <body> </body> </html>

I know the code is pretty self explainitary but i couldnt adjust it as required.

What i need to do is:

1: If resolution <= 600x800 then direct to "index_800x600.html"
2: If resolution > 600x800 and < 1152x864 then direct to "index_1024x768
.html"
3: If resolution >1152x864 then direct to "index_1152x864
.html"

Please advise as when i tried what i thought (it never worked !!)

I'm hoping it is fairly easy as i am keen to integrate this into my website.

TIA
Jako is offline   Reply With Quote
Sponsored Links
Old 01-13-2007, 11:38 AM   #2 (permalink)
netridge
Webmaster Widget Admin
 
netridge's Avatar
 
Join Date: Jul 2006
Location: California
Posts: 549
Default Re: Plz help to solve my js problem

TIA

Just change the address in index640x480.html, to the html file you want to link to or in this case redirect to. You might want to specify the whole path. for example = www.yourwebsite.com/index640x480.html

hope this helps

// file to load if resolution is 640x480:
var if640x480 ="index640x480.html";

// file to load if resolution is 800x600:
var if800x600="index_800x600.html";

// file to load if resolution is 1024x768:
var if1024x768="index_1024x768.html";

// file to load if resolution is 1152x864:
var if1152x864="index_1152x864.html";

// file to load if resolution is 1280x720:
var if1280x1024="index_1152x864.html";

// file to load if resolution is greater than 1280x720:
var Redirect ="http://www.google.co.uk";
__________________
www.webmasterwidget.com
netridge is offline   Reply With Quote
Old 01-15-2007, 07:04 AM   #3 (permalink)
fjhdehoog
Junior Member
 
fjhdehoog's Avatar
 
Join Date: Jan 2007
Location: the netherlands
Posts: 3
Default Re: Plz help to solve my js problem

Quote:
Originally Posted by Jako
I have a redirect script that i got from the internet written by fjhdehoog which i need slightly adjusting but i do not know how to.

Here is the script.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My Web Page</title> <script type="text/javascript"> <!-- Begin /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: fjhdehoog :: http://members.home.nl/fjhdehoog */ var thiswidth=screen.width; var thisheight=screen.height; // file to load if resolution is 640x480: var if640x480 ="index640x480.html"; // file to load if resolution is 800x600: var if800x600="index_800x600.html"; // file to load if resolution is 1024x768: var if1024x768="index_1024x768.html"; // file to load if resolution is 1152x864: var if1152x864="index_1152x864.html"; // file to load if resolution is 1280x720: var if1280x1024="index_1152x864.html"; // file to load if resolution is greater than 1280x720: var Redirect ="http://www.google.co.uk"; var msg="Sorry my page cannot be viewed with current resolution.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Set your resolution to 800 x 600.\nRedirecting to google.com"; location=(Redirect); // Do not change anything below this line // -------------------------------------- var width1 = 640; var height1 = 480; var width2 = 800; var height2 = 600; var width3 = 1024; var height3 = 768; var width4 = 1152; var height4 = 864; var width5 = 1280; var height5 = 1024; if (screen.width == width1 || screen.height == height1){ alert(msg);} else if(screen.width == width2 || screen.height == height2){ location=(if800x600);} else if(screen.width == width3 || screen.height == height3){ location=(if1024x768);} else if(screen.width == width4 || screen.height == height4){ location=(if1152x864);} else if(screen.width == width5 || screen.height == height5){ location=(if1280x1024);} else if(screen.width >= width5 || screen.height >= height5){ alert(msg); } //--> </script> <!-- Script Size: 2.05 KB --> </head> <body> </body> </html>

I know the code is pretty self explainitary but i couldnt adjust it as required.

What i need to do is:

1: If resolution <= 600x800 then direct to "index_800x600.html"
2: If resolution > 600x800 and < 1152x864 then direct to "index_1024x768
.html"
3: If resolution >1152x864 then direct to "index_1152x864
.html"

Please advise as when i tried what i thought (it never worked !!)

I'm hoping it is fairly easy as i am keen to integrate this into my website.

TIA
hi jako this is an old script i have updated it
to handle more resolutions and be more reliable
get it here
Resolution Redirect

plz do not remove link(This is not spam)
oh and u could have send me an email or contacted me to help you
well hope things worked out
peace
fjhdehoog

Last edited by fjhdehoog : 01-15-2007 at 07:27 AM.
fjhdehoog is offline   Reply With Quote
Old 01-15-2007, 05:17 PM   #4 (permalink)
fjhdehoog
Junior Member
 
fjhdehoog's Avatar
 
Join Date: Jan 2007
Location: the netherlands
Posts: 3
Default Re: Plz help to solve my js problem

hi pal
i took another look at your specific question
athough im not entirely sure what u want
i think this is it
(someone reading this and want the script plz check previous post,this script is modified on request)

<html>
<!-- Created on: 4-9-2006 -->
<head>
<title></title>
<script type="text/javascript">
<!--//
//Created by: fjhdehoog -
/*Scriptname : Resolution Redirect -- Custom limited to 3 resolutions-- */
var Redirect1='index800x600.html';
var Redirect2='index1024x768.html';
var Redirect3='index1152x864.html';
var thiswidth=screen.width;
var thisheight=screen.height;
//the alert text if resolution is greater than 1280x1024 then redirect to Redirect3
var msg="Current resolution too high to view my page correctly.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Lower your resolution.\nPage may not look pretty.";
/*NO NEED TO ALTER BELOW HERE */
if (thiswidth <= 800 && thisheight <= 600){location=(Redirect1);}
else if(thiswidth <= 1024 && thisheight <= 768){location=(Redirect2);}
else if(thiswidth <= 1152 && thisheight <= 864){location=(Redirect3);}
else if(thiswidth > 1152 && thisheight > 864){alert(msg);window.location=(Redirect3);}
//-->
</script>
</head>
<body>
</body>
</html>

mostlikely u already have figured it out
if not i hope this helps
peace

Last edited by fjhdehoog : 01-16-2007 at 01:46 PM.
fjhdehoog is offline   Reply With Quote
Old 02-07-2007, 04:43 AM   #5 (permalink)
Jako
Junior Member
 
Join Date: Jan 2007
Posts: 9
Default Re: Plz help to solve my js problem

Sorry for the delay !!

I am very grateful for all your time and effort.

Thanks to everyone who replied
Jako is offline   Reply With Quote
Old 02-20-2007, 02:31 AM   #6 (permalink)
dalewazhere
Junior Member
 
dalewazhere's Avatar
 
Join Date: Feb 2007
Posts: 32
Default Re: Plz help to solve my js problem

so, everythings resolved already?
dalewazhere is offline   Reply With Quote
Old 05-03-2007, 05:24 PM   #7 (permalink)
surfspeedy
Junior Member
 
Join Date: May 2007
Posts: 14
Default Re: Plz help to solve my js problem

You can find scripts like this at dynamicdrive.
surfspeedy is offline   Reply With Quote
Old 05-03-2007, 06:57 PM   #8 (permalink)
Krishnaswamy
Junior Member
 
Join Date: May 2007
Posts: 29
Default Re: Plz help to solve my js problem

Please let me know if what you really want is in your requirements 1 and 2. They appear to be reversed. Then it is jsut adjusting the javascript.
Krishnaswamy is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 01:33 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums