1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

If Then Statement

Discussion in 'JavaScript' started by michael chambers, Aug 22, 2017.

  1. #1
    Help please,

    I want to have a form with two fields one is height one is width the results to execute a java script in an i frame on same page as form.

    The coding i want to use for example in an if then statement is :

    If height = 720 and width = 500 then (statement goes here)

    Once code is set up i want to be able to add further statements for example :
    SEMrush
    if height = 720 and width = 500 then (statement 1 goes here)
    if height = 720 and width = 600 then (statement 2 goes here)
    if height = 720 and width = 700 then (statement 3 goes here)

    i can keep adding different statements all run from the height and width in the form input fields

    Any help would be appreciated in setting up this page including all coding.

    Thank You
     
    michael chambers, Aug 22, 2017 IP
    SEMrush
  2. Blank ™

    Blank ™ Well-Known Member

    Messages:
    220
    Likes Received:
    17
    Best Answers:
    5
    Trophy Points:
    110
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    Just write the code you're initially using, then edit it to add the rest as it comes up. If you mean that you need the format, try

    if((height == 720) && (width == 520)) {
    // do whatever here
    } elseif((height == 720) && (width == 600)) {
    //do it here
    } elseif(...) {
    //whatever
    }

    etc., etc.
     
    Rukbat, Sep 22, 2017 at 11:33 AM IP