Guest User

Untitled

a guest
Jul 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script src="http://www.w3schools.com/lib/w3data.js"></script>
  4. <!-- other js imports... -->
  5. <script>
  6. function selectCheck(event) {
  7. var opt = this.options[this.selectedIndex].value;
  8.  
  9. if (opt == "opt1"){
  10. //Load in html the file form.html
  11. }
  12. else{
  13. //Load in html the file form2.html
  14. }
  15. }
  16.  
  17. </script>
  18. <!-- other scripts... -->
  19. </head>
  20.  
  21. <body>
  22.  
  23.  
  24. <div class="form-group">
  25. <label for="exampleFormControlSelect1">Example select</label> <select
  26. class="form-control" id="exampleFormControlSelect" onchange="selectCheck.call(this, event)">
  27. <option value="opt1">option 1</option>
  28. <option value="opt2">option 2</option>
  29. </select>
  30. </div>
  31. <!-- the following lines load the html, but without any control. Here only the selected html should be loaded -->
  32. <div w3-include-html="html/form.html"></div>
  33. <div w3-include-html="html/form2.html"></div>
  34.  
  35. <script>
  36. w3IncludeHTML();
  37. </script>
  38.  
  39. </body>
Add Comment
Please, Sign In to add comment