Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Front Page</title>
- <script type="text/javascript" src="java.js"></script>
- </head>
- <body>
- <form id = "form2">
- <input type="button" onclick="AddFriends();" value="Friends" />
- <input type="text" id="myText" value="" onblur="alert(value)">
- </form>
- </body>
- </html>
- ------Javascript in separate file------
- function AddFriends()
- {
- var myTextField = document.form2.myText.value;
- var friends=["Tom","Tim","Lyn","Bob"];
- friends.push(myTextField);
- alert(friends);
- }
Advertisement
Add Comment
Please, Sign In to add comment