title: How to fix onload function with Conditional If and else
body: <p>My  problem here is the fact that I don't know how to do the if statement. for onload page I want when the id is #lang_link\[fr\] directly run function ParseJSON1 and when my id #lang_link\[en\] run function ParseJSON2
  I want to fix this:</p>
  <pre><code>window.onload = function runAtLoadTime() {
      if(document.getElementsById('#lang_link\\[fr\\]').value = 'fr' ){
          ParseJSON1();
      } 
      else 
      {
          ParseJSON2();
      }   
  }
  </code></pre>
  <p>to call:</p>
  <pre><code>$(document).ready(function (){
      $('#lang_link\\[fr\\]').click(function (){
          ParseJSON1('fr');
      });
      $('#lang_link\\[en\\]').click(function (){
          ParseJSON2('en');
      });
  });
  </code></pre>
  <p>code to run:</p>
  <pre><code>function ParseJSON1() {  
      var JSONObject = {  
          &quot;footerboutiques&quot;: &quot;Sourav french&quot;,  
          &quot;boutiquelink&quot;: &quot;https://www.w3schools.com/js/js_loop_for.asp&quot;,
          &quot;footerrestaurants&quot;: &quot;Kayal&quot;,  
          &quot;Restaurantslink&quot;: &quot;https://www.w3schools.com/js/js_loop_for.asp&quot;,
          &quot;footeracces&quot;: 24,  
          &quot;acceslink&quot;: &quot;https://www.w3schools.com/js/js_loop_for.asp&quot;,
          &quot;footeraerogare&quot;: &quot;123456&quot; ,
          &quot;aerogarelink&quot;: &quot;https://www.w3schools.com/js/js_loop_for.asp&quot;, 
      };  
      var Value = eval(JSONObject);  
      document.getElementById(&quot;footerboutiques&quot;).innerHTML = Value.footerboutiques; 
      document.getElementById(&quot;boutiquelink&quot;).href = Value.boutiquelink; 
      document.getElementById(&quot;footerrestaurants&quot;).innerHTML = Value.footerrestaurants; 
      document.getElementById(&quot;Restaurantslink&quot;).href = Value.Restaurantslink;  
      document.getElementById(&quot;footeracces&quot;).innerHTML = Value.footeracces;
      document.getElementById(&quot;acceslink&quot;).href = Value.acceslink; 
      document.getElementById(&quot;footeraerogare&quot;).innerHTML = Value.footeraerogare;  
      document.getElementById(&quot;aerogarelink&quot;).href = Value.aerogarelink; 
  }  
      
  function ParseJSON2() {  
      var JSONObject = {  
          &quot;footerboutiques&quot;: &quot;Sourav2 english&quot;,  
          &quot;boutiquelink&quot;: &quot;https://developer.mozilla.org/fr/docs/Web/API/Document/getElementById&quot;,
          &quot;footerrestaurants&quot;: &quot;Kayal2&quot;,  
          &quot;Restaurantslink&quot;: &quot;https://developer.mozilla.org/fr/docs/Web/API/Document/getElementById&quot;,
          &quot;footeracces&quot;: 242,  
          &quot;acceslink&quot;: &quot;https://developer.mozilla.org/fr/docs/Web/API/Document/getElementById&quot;,
          &quot;footeraerogare&quot;: &quot;1234562&quot; ,
          &quot;aerogarelink&quot;: &quot;https://developer.mozilla.org/fr/docs/Web/API/Document/getElementById&quot;,  
      };  
      var Value = eval(JSONObject);  
      document.getElementById(&quot;footerboutiques&quot;).innerHTML = Value.footerboutiques;  
      document.getElementById(&quot;boutiquelink&quot;).href = Value.boutiquelink; 
      document.getElementById(&quot;footerrestaurants&quot;).innerHTML = Value.footerrestaurants; 
      document.getElementById(&quot;Restaurantslink&quot;).href = Value.Restaurantslink;  
      document.getElementById(&quot;footeracces&quot;).innerHTML = Value.footeracces;  
      document.getElementById(&quot;acceslink&quot;).href = Value.acceslink; 
      document.getElementById(&quot;footeraerogare&quot;).innerHTML = Value.footeraerogare ;
      document.getElementById(&quot;aerogarelink&quot;).href = Value.aerogarelink; 
  }
  </code></pre>