title: How to use JavaScript to change the form action
body: <p>My current code is as follows:</p>
  
  <pre><code>&lt;div class="fr_search"&gt;   
    &lt;form action="/"  accept-charset="UTF-8" method="post" id="search-theme-form"&gt;
    .......
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now I want to write a function to change the form action and method, when a condition is met. How do I write this code?</p>
  
  <p>For example, </p>
  
  <pre><code>function test() {
     if (selectedIndex === 1)....
  } // How do I write this code?
  </code></pre>