Suite101

JavaScript

Muhammad Ali Shah

Latest Articles

Comparing Dates Using JavaScript

Comparing two dates is a problem general enough to get special attention. When you develop a general purpose solution to such problems, you have a reusable piece of code that can save you hours of reinventing the wheel.

Parsing Integers in JavaScript: Problems and Solutions for Invalid Inputs

Converting strings to integer is an every day task for web developers. Those who have used JavaScript to validate forms already know the basics. We will see how JavaScript can help us and how a very basic insight into a simple function will eliminate redundant tasks.

Date Validation

You can't just ignore invalid input by the user. Validation can be done either at client side or at server side. But with client side scripting, you can verify the input as quickly as possible without causing precious trips to the server.

Truncating Real Numbers

Use regular expressions to solve the problem of truncating decimal numbers on web pages. You can use this technique to show the result of a division upto two decimal places, etc.

Accepting n Arguments

Learn how to write functions that accept multiple arguments. With JavaScript, you can call such functions with variable number of arguments.

Capturing Keys - Part I

This week's article gives you an insight in a straight and simple manner into the event object and teaches you how you can use it in your pages. We will develop a page that opens up a new window and displays a help message whenever the user presses F2 key.

The Event Object

Continuing with the theme picked up in the last article, today we will see how to declare default event handlers. Default event handlers fire (or are called up) when the associated event occurs, without requiring a programmer to write explicit code. Along with that we will also see the event object. ...

Simple Event Handling

The cyberspace is shifting from web pages to web applications. With this article we are starting a whole debate on advanced features of JavaScript - from event handling to DHTML. Our main focus will be on IE 5.x.

The eval() Function

Todays article discussed the built in eval function which lets you define and execute code on the fly. Depending on values of different variables a particular statement may need to be executed at run time. This is where eval function comes in.

Disabling Right Click

Learn the browser independent way of disabling right click on your pages. Possible uses include protecting your images from being saved in a novice manner. The technique is to capture the right button click in your document...

view all articles