Partners AdvanCode.com: free classifieds · RSS · Toronto · driving schools · dating

Windows, Word, Excel & Internet articles.

Home

Categories
MS Windows (7)
MS Word (7)
MS Excel (6)
Internet & Email (11)
HTML (6)

Top 10 articles
Google Adsense: what you need to know! (72671)
Protecting Excel documents (62951)
Working with files and folders (55701)
Comments in Excel (54058)
How To Create Your Own Blog Using Blogger (50207)
Useful MS Word shortcuts (46361)
Create charts with MS Excel (37380)
Page Setup (37073)
Using IF function (35071)
Five Proven Ways To Increase Internet Sales (33179)

Recommend it

 Questions? Ask
    them in our forum.

 

Search:
Google
Web
PCLessons.info

Rate this article






We have just lauched a new forum where you can ask anything about all these topics: Windows, Excel, Word, Internet and more.

Introduction to JavaScript


Added: 2005-01-20, Views: 4271, Ratings: 0


'JavaScript' is a scripting language available in many of the Internet browsers, interacting with HTML code. It was initially developed by Netscape and is based on C++ / Java. This is not the only scripting language available in browsers - you might use VBScript especially in Internet Explorer.

There are a few versions of this language script, but many times we only need JavaScript 1.0. JavaScript has a few objects like window or document, which have a few methods and properties. This is just an introduction, so we don't list all these methods and objects.

JavaScript (or JS) is introduced by a HTML tag: <script></script>. You can mention its version or to use JS code fron an external file:

<script language="JavaScript" src="some_file.js"></script>

This will use JS code from some_file.js from current folder. Another solution is to write JS code directly in this file between <script> & </script> tags (see below).

There are many situations when you need JavaScript to interact with the user from the browser, like displaying a message box, a confirmation, openning an additional window (popup) or validating some values from a form. All these can't be performed without JS. This scripts could be wherever in your page, both in <head> .. </head> or <body> .. </body>. If you write the code in BODY it's important to have scripts defined before you use them.

The simplest way is to show you some examples.

First one is to show a message when page opens (place this code somewhere in BODY):

<script language="JavaScript">alert("Welcome to my page!");</script>

Second example is to open a new window when click a link:

<a href="javascript:void(0)" onclick="javascript:window.open('http://google.com');">Click here</a> to open a new page.

More examples will be shown in other articles where we should explain more details about JavaScripts. Many sites are using intensively JavaScript to display their content, just that many of these examples are not trivial. We hope we started your interest in studying more JavaScript.

 

Comments:
Name
Email
Web (without http:// part)
Comments

Security Code: (case sensitive)