Form selection redirect


This will allow you to make a form selection and on change redirect to a URL.

Add the below code to you HEAD section.
JavaScript Code
  1. <script type="text/javascript">
  2. <!--<![CDATA[
  3. function switchme(){
  4. if(document.getElementById('url').value != ''){
  5. window.location = document.getElementById('url').value;
  6. }
  7. }
  8. //}}>-->
  9. </script>


Now we can make the form. Put this in the BODY section.
JavaScript Code
  1. <select name='url' onchange='switchme()'>
  2. <option>Select an option</option>
  3. <option value='https://www.rmb-scripting.com'>RMB</option>
  4. <option value='https://www.google.co.uk'>Google UK</option>
  5. <option value='https://www.youtube.com'>YouTube</option>
  6. </select>


Just change the options to what you want it to say and the value you want them to redirect too.
DanielXP's Avatar
Author:
Views:
1,980
Rating:
There are currently no comments for this tutorial, login or register to leave one.