How to Create Java Script

Instructions
Things You'll Need:

* Computer with a Web Browser (such as Internet Explorer or Firefox)
* A text editor (such as notepad)

1.
* 1

Open the text editor (such as notepad on the Windows system). Web browsers read plain text documents created in text editors like notepad.
* 2

Enter the HTML and JavaScript into the text file. A minimal HTML file will look like this:




This is my first web page!




The and tags should always surround the content of the web page, including any embedded JavaScript.
* 3

Enter the JavaScript into the body of the HTML. The file will look like this:









The tags must surround any JavaScript to tell the browser that it should execute the content in the tags as JavaScript. The "document.write("This is my first web page!")" statement tells the browser to write the sentence in the parentheses to the browser window.
* 4

Save the file in HTML format. The text editor will save files with the .txt file extension by default. This just means that the web browser will not read it as a web page. Save the file with the .html extension by clicking "File," then "Save As." In the "Save File" window that appears, highlight the name of the file in the "File Name" box towards the bottom. Rename the file "filename.html" (with the intended name replacing "filename" and quotation marks included).
* 5

Open the file in a web browser. In the web browser, click on "File," and "Open File," then navigate to the file and select it. The browser should open it like any other web page. The text should appear in the browser window, without the formatting tags.

0 comments:

Post a Comment

 
© 2011 HOW TO .
Content License | Recode by Ruchin panchal Only Android Developers