简体   繁体   中英

JAVASCRIPT could somebody help me with this code?

I'm trying to set a conditional page load on a Form Submit, following "If users select [x + y] option, send them to [x] page". I'm really not that familiar with JavaScript, how should i do?

Here's my HTML:

<div id="choice">
   Geographic area 
       <select name="geoarea" size="1">
            <option value="area"> Select </option>

            <option value="1"> Europe, America, Oceania </option>
            <option value="2"> Eastern Asia </option>
            <option value="3"> Middle East </option>    
       </select> <br>

   Type of itinerary 
      <select name="itinerary" size="1">
            <option value=""> Select </option> 

            <option value="4"> Arts-Cultural </option>
            <option value="5"> Religious </option>
            <option value="6"> Wine and Food </option>
            <option value="7"> Seaside </option>
            <option value="8"> Naturalistic </option>
      </select> <br>

   <form method="post" action="url_script">
      <input type="submit" name="continue" value="continue">

   </form>  
</div>

instead of submit form , use a submit button, when clicked ,call a ajax call to the 'url_script' or whatever page u want... ajax call can send info to the called page and get info back to javascript call.

Also if u just want to open a new page when something is selected, use window.open("new_page_url")....

<input type=button onclick="somefunction()">

somefunction()
{ window.open("new_page"); 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM