Jump to content

Recommended Posts

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

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.