SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Convert php to javascript

    Hi Guys!

    I need to convert the following PHP code to javascript. How can I do that?

    PHP Code:
    if(($_GET['assets'] > 0) && ($_GET['assets'] < 2500000)) {$band "2000";}
            if((
    $_GET['assets'] > 2500001) && ($_GET['assets'] < 5000000)) {$band "3000";}
            if((
    $_GET['assets'] > 5000001) && ($_GET['assets'] < 10000000)) {$band "3750";}
            if((
    $_GET['assets'] > 10000001) && ($_GET['assets'] < 15000000)) {$band "4500";}
            if((
    $_GET['assets'] > 15000001) && ($_GET['assets'] < 25000000)) {$band "5250";}
            if((
    $_GET['assets'] > 25000001) && ($_GET['assets'] < 50000000)) {$band "6750";}
            if((
    $_GET['assets'] > 50000001) && ($_GET['assets'] < 75000000)) {$band "7500";}
            if((
    $_GET['assets'] > 75000001) && ($_GET['assets'] < 100000000)) {$band "8250";}
            if((
    $_GET['assets'] > 100000001) && ($_GET['assets'] < 150000000)) {$band "9000";}
            if((
    $_GET['assets'] > 150000001) && ($_GET['assets'] < 250000000)) {$band "11250";}
            if((
    $_GET['assets'] > 250000001) && ($_GET['assets'] < 400000000)) {$band "13500";}
            if((
    $_GET['assets'] > 400000001) && ($_GET['assets'] < 550000000)) {$band "15750";}
            if((
    $_GET['assets'] > 550000001) && ($_GET['assets'] < 700000000)) {$band "19125";}
            if((
    $_GET['assets'] > 700000001) && ($_GET['assets'] < 1000000000)) {$band "22500";}
            if((
    $_GET['assets'] > 1000000001) && ($_GET['assets'] < 1500000000)) {$band "28125";}
            if((
    $_GET['assets'] > 1500000001) && ($_GET['assets'] < 2000000000)) {$band "33750";}
            if((
    $_GET['assets'] > 2000000001) && ($_GET['assets'] < 10000000000)) {$band "45000";}
            if((
    $_GET['assets'] > 10000000001) && ($_GET['assets'] < 25000000000)) {$band "65000";}
            if((
    $_GET['assets'] > 25000000001) && ($_GET['assets'] < 50000000000)) {$band "75000";}
            if((
    $_GET['assets'] > 50000000001) && ($_GET['assets'] < 9999999999999999999999999999)) {$band "85000";} 

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    Other than needing to change the PHP sybtax to javascript syntax, you can access the GET variable by using the location property and splitting off after the "?" to get the "assets=###".


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •