Advertisement
fayimora

Accessing form elements by name

May 8th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.55 KB | None | 0 0
  1. <?xml version = "1.0" encoding = "utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4.  
  5. <html xmlns = "http://www.w3.org/1999/xhtml">
  6. <head>
  7.     <title> Sample </title>
  8.     <script type = "text/javascript">
  9.         function meBeenPushed()
  10.         {
  11.             alert("I have been pushed");
  12.         }
  13.     </script>
  14.  
  15. <body>
  16.     <form name = "myForm" action = "">
  17.         <input type = "button" value = "pushMe" name = "pushMe" />
  18.     </form>
  19.     <script type="text/javascript">
  20.         document.myForm.pushMe.onclick=meBeenPushed;
  21.     </script>
  22. </body>
  23. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement