MDanz Posted February 18, 2010 Share Posted February 18, 2010 i'm trying to simplify the url, how do i do this within the code below.. if width & height = 1024 & 768 and declare that as variable "1". if width & height = 1360 & 768 and declare that as variable "2". then the url would be test.php?s=1 for the width and height 1024x768 <script type="text/javascript"> width = screen.width; height = screen.height; if (width > 0 && height >0) { window.location.href = "test.php?w=" + width + "&h=" + height; } else exit(); </script> Link to comment https://forums.phpfreaks.com/topic/192572-help-re-doing-this-code/ Share on other sites More sharing options...
seventheyejosh Posted February 19, 2010 Share Posted February 19, 2010 Something like this? <script type="text/javascript"> var width= screen.width; var height= screen.height; var shortOne= 0; //or fail or nothing, up to you if(width==1024 && height==768){ shortOne=1; }//end if if(width==1360 && height==768){ shortOne=2; }//end if window.location.href="test.php?s="+shortOne; </script> Link to comment https://forums.phpfreaks.com/topic/192572-help-re-doing-this-code/#findComment-1014615 Share on other sites More sharing options...
MDanz Posted February 19, 2010 Author Share Posted February 19, 2010 thx got it working!!! Link to comment https://forums.phpfreaks.com/topic/192572-help-re-doing-this-code/#findComment-1014622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.