Login 
Password
  
 


JavaScript Cert. Exam
Test your skills with our JavaScript certification exam and see how you stack up right now.

Homepage
Visit our homepage and find out more about what NCSA can do for you.

Introduction to JavaScript
Using JavaScript on your Webpage
A Simple JavaScript Application
Variables & Operators
Variables
Operators
Loops & Conditionals
Loops
Conditionals
Document Object Model
Nodes
Functions & Methods
Built-in Functions
User Defined Functions
Forms & Events
Forms
Events
Browsers
Cookies
Image Maps
Timing Events

Learn More About Us
Find out more about how our certifications can benefit you.

Course Descriptions
View a complete listing of certifications available through NCSA.

Employer Programs
Visit our employer programs page and discover the options available to connect you with our customers.

Certificate Database
Lookup a certification in our online database.

Affiliate Program
Make money by helping people get the computer training and certification they need. Sign-up Here!

Support Center
If you have questions or concerns feel free to visit our online support center.


 

A Simple JavaScript Application


 

Let’s start with developing a simple JavaScript application that displays the text “Hello World”. JavaScript can be saved in standalone files with the .js extension or embedded directly into the HTML on your page. Use HTML's script tag to let the browser know how to interpret your code as shown in the code block below. To try this out on your own, use any basic text editor, notepad for example, to write the code. Before you start writing the code, you need to know that:

  • JavaScript is case sensitive and you need to put semi-colons at the end of each JavaScript statement.
  • You can add comments to the code by using double slash (//). To add multi-line comments adding "/*" at the beginning line "*/” at the ending line.
  • You should also add comments around the script code, as shown in the code sample to ensure that the old browsers that do not understand the JavaScript code simply ignore the script and do not generate an error.

     

    <script type="text/javascript">

    <!--

     

    //JavaScript goes here

     

    //-->

    </script>

 

 

Perform the following steps to write the application:

 

  1. Open the Notepad by clicking Start->Programs->Accessories->Notepad

  2. Add the following code to it:

    .

    <html>

    <body>

    // Script tag will tell the browser that the scripting language used is Java Script

    <script type="text/javascript">

    // This function will take a string parameter and display it on the web page

    document.write("Hello World!");

    </script>

    </body>

    </html>

     

  3. Save the file with .html extension

  4. Double click the file. The output appears, as shown in Figure.

 

 


NCSA OnDemand Training Courses



Web-based Training Courses, including 7,500+ Videos & Articles, covering:

Microsoft Office
2003 | 2007
Microsoft Windows
Vista
Visio
2003 / 2007
OneNote
2003 / 2007
Project
2003 | 2007
Sharepoint
3.0
Access
2003 | 2007
Excel
2003 | 2007
Outlook
2003 | 2007
PowerPoint
2003 | 2007
Word
2003 | 2007
Office for Mac
2008
Excel for Mac
2008
Entourage for Mac
2008
PowerPoint for Mac
2008
Word for Mac
2008

Acrobat 8 Professional ADO.NET 2.0 ASP.NET 2.0 for Visual Basic 2005
C# 2005 Crystal Reports XI Exchange Server 2003
Flash 8 ActionScripting Flash 8 for Designer FrontPage 2003
Mind Manager 7 Pro + Project 2007 Mind Manager 7 Pro Fundamentals Office 2007 - What's New
Photoshop CS2 PHP Programming QuickBooks Pro 2006
SharePoint End User: Administrator SharePoint End User: Contributor SharePoint End User: Reader
Small Business Server 2003 SQL Server 2005 Visual Basic 2005
Windows Server 2003

Order NCSA OnDemand today and get access to over 7500 quality instuctor led videos and training courses covering today's most popular software programs and programming languages.

OnDemand Monthly - $25/month
No long term commitment.
Annual Member - $159/year
Save 50%off monthly price.
Premium - $249/year
Includes NCSA certifications


    

  
HOME    PRIVACY    EMPLOYERS    CERTIFICATION LIST    AFFILIATES    CONTACT US

© 2002-2010 National Computer Science Academy, All Rights Reserved.