Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1.  
  2.  
  3. // this reloads current window with specificed url
  4.  
  5. <script>
  6. // onclick event is assigned to the #button element.
  7. document.getElementById("button").onclick = function() {
  8. window.location.href = "https://www.example.com";
  9. };
  10. </script>
  11.  
  12.  
  13. // This appends a url with whatever data is entered into the form.
  14.  
  15. <html>
  16. <!-- Include jQuery! -->
  17. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  18. <body>
  19. <form id="form1">
  20. <input name="channel" type="text" id="foo">
  21. <button type="submit">Submit</button>
  22. </form>
  23.  
  24. <p id="displayURL"></p>
  25.  
  26. <script>
  27. $(document).ready(function () {
  28. var form = document.getElementById("form1");
  29. $(form).submit(function () {
  30. var domain = "http://mywebsite.com?";
  31. var data = $(this).serialize();
  32.  
  33. document.getElementById("displayURL").innerHTML = domain + data;
  34.  
  35. return false;
  36. });
  37. });
  38. </script>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement