Jump to content

Help re-doing this code


MDanz

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.