Technology Programming

How to Use Tags With JavaScript

    • 1). Design your Web form using standard HTML coding. If you don't already have a form set up, you can create one. The following is an example of a small form with only one text box:

      <form name="myform">

      <input type="text" name="inputtext">

      <input type="submit">

      </form>

    • 2). Create a Javascript block after the closing </body> tag and before the closing </HTML> tag of your document by inserting the following code (see the "Tips" section for a working example of how this should appear):

      <script type="text/javascript"> </script>

    • 3). Create a Javascript function to work with the form field tags. You must use each tag's name to edit the properties in the tags. For instance, the following Javascript function adds text to the text box created in step one:

      <script type="text/javascript">

      document.getElementById("mytextbox").value = "Hello World";

      </script>

      Notice the first part of the command is "document," which indicates that you want to use the main document loaded in the Web browser; "mytextbox" is the name of the form field, and the "value" property is the text value added to the text box.

    • 4). Save your changes and then load the HTML file into your Web browser. The page should have a text box and a submit button; the Javascript command has inserted the words "Hello world" into the text box.

Related posts "Technology : Programming"

Brochure Design And Its Budget

Programming

Website designing delhi-web design services India-Website Development Company India

Programming

The Secrets and techniques Rob Fore Won't Tell you!

Programming

Where Do You Get Podcasting Ideas?

Programming

Avoid Hacking With The Help of WordPress Development Company

Programming

Sirius Radio - All You At Any Time Wished to Know

Programming

How to Use a Check Box to Filter a List

Programming

Get professional help from website development Dublin- promote business growth

Programming

PHP Shopping Carts

Programming

Leave a Comment