Articles → JavaScript → Introduction to JavaScript

Introduction to JavaScript












Document Object Model






<html>
  <head>
    <title>DOM example</title>
  </head>
  <body>
    <form>Enter Name   <input type="text" name="txtName" /></form>
  </body>
</html>




Picture showing the DOM on the web browser

Click to Enlarge








Implementation








<script language = "JavaScript">
</script>




function ClickMe() {
	alert(document.forms[0].txtName.value);
}






<input
  type="button"
  name="btnDOM"
  value="Click Me"
  onclick="javascript:ClickMe();"
/>




<html>
  <head>
    <title>DOM example</title>
    <script language="JavaScript">
      function ClickMe()
      {
      	alert(document.forms[0].txtName.value);
      }
    </script>
  </head>
  <body>
    <form>
      Enter Name  
      <input type="text" name="txtName" />
      <input
        type="button"
        name="btnDOM"
        value="Click Me"
        onclick="javascript:ClickMe();"
      />
    </form>
  </body>
</html>





Posted By  -  Karan Gupta
 
Posted On  -  Thursday, July 1, 2010

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250