rediff ILAND
Welcome Guest, | Create your own iLand| Sign In  | New User? Get Started
Home
iLand
Blogs
Friends/Contributors
Guestbook  
 
Shashidhar Kumar
Categories
Software
Free-Code
Tutorial
Poetry
Favourites 1
Indu Vohra
What is an RSS feed?
RSS Feed 
shashionline.rediffiland.com/ 
Recent Posts
 16:33 | 29/Aug/2007 | 0 Comment(s)
My First Love...

 
 I LOVE YOU even I don't know your name
It has been more than three months or more but still
I don't know your name
Your beauty and the deep love that I have
Make me to be afraid of you, , , to speak to you
even ask you your name.....

Permalink 
 15:33 | 23/Aug/2007 | 0 Comment(s)
Onsubmit of Forms - HTML

onsubmit

When using java-script to check a form, the first thing you need is the onsubmit event handler.
This event handler specifies a script that is executed when the user submits the form. That script is where
you check whether certain fields have a value, whether the user has checked at least one checkbox,
and any other checks you deem necessary.

The general syntax is:


where checkscript() is the name of the script. This script should return either true
or false. If false is returned, the form will not be submitted. If either true
or false is returned the script stops.

So the general script becomes something like:

function checkscript() {
if (some value is/is not something) {
// something is wrong
alert('alert user of problem');
return false;
}
else if (another value is/is not something) {
// something else is wrong
alert('alert user of problem');
return false;
}

// If the script makes it to here, everything is OK,
// so you can submit the form

return true;
}
Of course this function can become much more complex if you have to check a complicated
form with a lot of radio buttons and things. The general idea remains the same, however: You
go through the elements, check whatever you want to check and as soon as you find any mistake, you return false, after
which the script stops and the form is not submitted.

Once you've found a mistake, you should notify the user of the problem. This used to be done by an alert,
but nowadays you can generate error messages and insert them next to the form field.

Only at the very end of the script, when you have checked all elements and encountered no mistakes,
you return true, after which the form is submitted.

Permalink 
 15:33 | 23/Aug/2007 | 0 Comment(s)
Accessing the form elements - HTMl

Accessing the form elements

The form validation script needs to access the form in the HTML page to determine
what values the user has filled in. So first we have to enter the form by means of the
Level 0 DOM.
The general syntax for accessing a form element is:

document.forms[number].elements[number]

When the page is loaded, java-script makes an array forms in which it
puts all the forms that are on the page. The first form is forms[0], the
second is forms[1] etc.

Each form has another array in which java-script puts all the elements in the form.
The first elements is elements[0], the second elements[1] etc.
Every ,