Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this reloads current window with specificed url
- <script>
- // onclick event is assigned to the #button element.
- document.getElementById("button").onclick = function() {
- window.location.href = "https://www.example.com";
- };
- </script>
- // This appends a url with whatever data is entered into the form.
- <html>
- <!-- Include jQuery! -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <body>
- <form id="form1">
- <input name="channel" type="text" id="foo">
- <button type="submit">Submit</button>
- </form>
- <p id="displayURL"></p>
- <script>
- $(document).ready(function () {
- var form = document.getElementById("form1");
- $(form).submit(function () {
- var domain = "http://mywebsite.com?";
- var data = $(this).serialize();
- document.getElementById("displayURL").innerHTML = domain + data;
- return false;
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement