Javascript
The Introduction Part
JavaScript is a client-side scripting language that many webmasters find quite useful. Essentially, JavaScript performs simple actions within the viewer's web browser. This is advantageous because it means that the viewer doesn't need to wait for the website to communicate with the server again.
JavaScript was designed to be similar to many other programming languages (for example, its syntax is quite like the C programming language). It is streamlined, with simple naming conventions, and is designed to be easy to learn. Many web designers learn JavaScript not long after becoming familiar with the basics of static web content such as HTML and CSS. (Andreessen)
Conceptually, JavaScript is similar to AJAX in that in runs within the web browser to perform simple tasks. There are numerous uses for this sort of technology; even though it won't provide the fully dynamic feel that a data-driven website will--JavaScript doesn't interact with much data on the server. Effective use of JavaScript can make your website more intuitive, and can provide your users with a more productive experience. (Web Programming)
Examples: JavaScript, in some form, is used in many websites today. Common examples include user data validation, pop-up windows, and increased responsiveness to user actions. The first is common when the user is expected to enter data; for example, if a website asks for a telephone number and an email address, but the user enters data that does not meet the specific format of telephone numbers (xxx-xxx-xxxx) or email addresses (x@y.z), JavaScript can be used to stop the submission of that data and prompt the user to correct their error. Since many forms of interactivity rely on users submitting data or comments, this form of verification is useful. So, too, is JavaScript used to create pop-up windows and boxes that ask the users to confirm their actions--this can prevent users from taking significant actions, like ordering a product online, inadvertently. As a final example, JavaScript is also used to highlight things for the user; some sites will change the background of a textbox in which the user is currently typing or the link over which the user is currently hovering his or her mouse cursor to highlight such facts to the user. Such highlighting can make submitting data and navigating a website easier.
Using it...
Getting started with JavaScript is quite easy. JavaScript is a client-side technology, which means that there’s no new software installed on the web server for it. JavaScript is part of the actual webpage itself, next to the HTML code. It has a special tag of its own, called the <script> tag. JavaScript code is contained within these tags in the header—a special section—of the HTML page.
JavaScript is also relatively easy to learn and is similar to languages such as Java, C, and C#. To get started with JavaScript, create a basic HTML page, and in the header, add a <script> tag. For example, you could write the following between the <head> tags:
<script language="JavaScript">
alert("Welcome to my page.");
</script>
This would create an alert box that pops up when the visitors views the page and displays a welcome message. Click here to visit this page with the above alert added using Javascript. This feature is one of the most basic in JavaScript.
JavaScript is best used tastefully and sparingly. Most users don’t want to be bombarded with messages each time they click a link—so don’t bombard them! Most users, however, do want to be informed when they’ve submitted invalid data into a form, so it’s certainly appropriate to inform them, often using JavaScript, of such.
There are excellent free resources for JavaScript all over the web. We encourage you to explore it, both for its own merits and as a gateway to more complex, but similar, technologies. The three resources below are excellent overviews for beginners.
No comments:
Post a Comment