How to Add Javascript Using HTML Programming

You can add JavaScript to your web pages to make them more interactive and entertaining. JavaScript is a scripting language used to add elements like functionality or validating forms to a site. JavaScript can be used to create drop-down menus, alert messages and more. There are many places on the internet that offer free JavaScripts; or, if you know JavaScript scripting language, you can create your own.

Instructions

    • 1

      Start the word processor or text editor you will use to create your web page. Locate the web page you will be editing. Position the cursor where you want the JavaScript to appear on your page.

    • 2

      Type <SCRIPT TYPE=“text/javascript”> on your page.

    • 3

      Type the code for the JavaScript you will be using.

    • 4

      Type </SCRIPT> to complete the JavaScript. Your text should be similar to the following example, which shows JavaScript added to display a pop-up message:<SCRIPT TYPE=“text/javascript”>Alert(“All visitors to our site can enter to win our fast cash drawing with no obligation!”);</SCRIPT>

    • 5

      Open a new web browser to verify that your web page is running the JavaScript correctly. Test the JavaScript to verify that it is user-friendly.

Tips & Warnings

  • Display your web page in several browsers to see how each one renders it.

  • You can store your JavaScript codes in separate files so your web page will not be cluttered, or to enable you to use JavaScript on several web pages.

Related Searches:

Comments

You May Also Like

Related Ads

Featured