How to Write Script Files

104 1
    • 1). Open a new Notepad or WordPad file and save it to your desktop with the extension "html". Go into your new file by right-clicking the icon. A menu will appear. Click the phrase "Open With" and then click "Notepad" or "WordPad", depending on which application you use.

    • 2). Place "<html><body>" at the top of your opened page. Put the symbol "</body></html>" just below that. Your script files will eventually go in between the HTML signs and symbols. Make sure you use left and right angle brackets. This is how Internet browsers distinguish between markups (clues that tell computers and browsers what a piece of information should look like) and scripts (which tell the marked information how to run).

    • 3). Write scripts between your HTML symbols. Start by telling an Internet browser what language you are using with this: "<script type="text/javascript">" or <script type="text/vbscript>". The string could look like this: <html><body><script type="text/javascript"></script></body></html>". Prepare to tell your computer what sentences will appear on your Web page. Text inside angle brackets do not show up while text outside the angle brackets will. If you opt to use "text/vbscript" instead of "text/javascript", do not use a semicolon.

    • 4). Type "document.write" underneath the "script type="text/javascript". Place parentheses and quotes with a semicolon at the end of your text line like this: "<script type="text/javascript">document.write("This sentence will appear on the page!");</script>". A good example could look like this: <html><body><script type="text/javascript">:"<script type="text/javascript">document.write("This sentence will appear on the page!");</script></script></body></html>." Make sure there is not a space between the "e" in "write" and the parenthesis next to it. Your computer will misinterpret the language and not give you the results you want. Save your work and close out of your file. Review your scripts by double-clicking the Web page icon.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.