title: if statement not seem not be correct javascript
body: <p>I am having problem with my <code>if</code> statements, <code>else</code> and <code>else if</code>.</p>
  
  <p>This is my code: </p>
  
  <pre><code>function draw(d) {
      var testarray = JSON.parse(a);
      var testarray1 = JSON.parse(a1);
      var testarray2 = JSON.parse(a2);
  
      var Yaxis = $("#&lt;%=hidden10.ClientID%&gt;").val();
  
      if (d == 1)
      {
          var c = testarray
          Yaxis = 'data';   
      }
      else if (d == 1)
      {
          var e = testarray1
          Yaxis = 'data1';
      }
      else if (d == 2)
      {
          var c = testarray
          Yaxis = 'data2';
      }
      else if (d == 2)
      {
          var e = testarray1
          Yaxis = 'data3';
      }
      else(d == 3)
      {
          var e = testarray1
          Yaxis = 'data4';
      }
  </code></pre>
  
  <p>When I debug the code, it only hits <code>d==1</code> and then goes to <code>d==3</code> and skips out <code>1</code> and <code>2</code>. For the <code>yaxis</code> it only shows <code>data4</code>, and doesn't show <code>data</code>, <code>data1</code> and <code>data2</code> on my graph.</p>
  
  <p>Apparently my <code>else</code> statement is not correct, but I have <a href="http://www.tizag.com/javascriptT/javascriptelseif.php" rel="nofollow">googled the <code>if</code> statement</a> and it seems that I have done it correctly, but it's not working.</p>
  
  <p><code>d</code> is a radio button calling from code behind in vb:</p>
  
  <pre><code>Select Case RadioButtonList1.SelectedItem.Value
      Case 1
  
  
          Dim Yaxis As String
          If RadioButtonList1.SelectedItem.Value = 1 Then
              Yaxis = "data"
          End If
  
  
          hidden10.Value = Yaxis
  
  
          For Each row In Year1
              testarray.Add(row("kWh"))
          Next row
  
  
          Dim arrayJsonTest1 As String = serializer1.Serialize(testarray)
          Dim arrayJson11 As String = serializer1.Serialize(testarray1)
  
  
          hidden.Value = arrayJsonTest1
          hidden1.Value = arrayJson11
          hidden2.Value = arrayJson12
  
  
          ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "draw", "javascript:draw(1);", True)
  </code></pre>