Reading, writing and deleting cookies in client side using JavaScript

Hi,

 

I have discussed about cookies in my previous posts. But in all those posts I talked about working with cookies in server side.

You can read these posts here

 

Continued...

Javascript function for formatting number

Hi

A few days back one of my friend ask me to write an interesting JavaScript function. He was doing a lot of calculation in the form with the help of JavaScript, to the give the web page a desktop like feeling. Now he wanted to display the values in certain format.

The format was predefined but was different for different users. The for mat also required the commas to come at different places for different users. Like for user the value would be 1,00,00,00,000 and other it will be 1,000,000,000. Here the commas separation comes after different places for different kind of format. (The other complication of the function was that a comma instead of dot would some time represent decimal separation. But that’s not part of this post.)

Continued...

Multiple argument passed to a JavaScript Function at runtime

Hi

Today I as working with some JavaScript code and had a function where the number of parameters would change in the runtime. Actually I had to do a validation where the number of textbox to equate the value for. I wanted to pass the array of textbox to the function. 

But then I googled a bit and found a very nice feature of JavaScript which I had heard before. In JavaScript we can pass any number of parameter and get these parameter at run time.

JavaScript functions have a special property called arguments. these contain and array of the input parameters. we can use the length property of the array and loop through the parameters passed to the function. This enables the development of function where the number of parameters can change at runtime.

<SCRIPT Language="JavaScript">

function vikFunc()

{

Continued...
 
Copyright © 2006 - 2008 Vikram Lakhotia