How to Incorporate JavaScript in a Web Page

By eHow Internet Editor

Rate: (2 Ratings)

JavaScript is a powerful Web scripting tool that allows Web developers to create dynamic Web pages that can change before the viewer’s eyes. JavaScript can be hard to learn, however. Follow this guide to your first steps in incorporating JavaScript in your Web page.

Instructions

Difficulty: Moderately Challenging

Things You’ll Need:

  • Internet access
  • Computer

One Type of Code

Step1
Find the tag in the code of your Web page. It should be toward the top of the code.
Step2
Move the tag down one line on your code. If the tag is on a line with other code, move it to its own line and then move it down another line.
Step3
Insert the following code on the line above the tag.



The code between the tags is the code you’re going to call from within your Web page. This way, you can have many functions at the top of your Web page and call them all as you need them. The code we’ve used will, when "talktome" is invoked, pop up an alert box saying "I love it when you talk to me."

Another Easy Code

Step2
Save your file as "talk.html."
Step3
Open "talk.html" in your Web browser.

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article: How to Incorporate JavaScript in a Web Page

eHow Internet Editor

eHow Internet Editor

Category: Internet

Articles: See my other articles

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.