JavaScript for client-side data validation

Source: Internet
Author: User
Tags html page return client
Javascript| Client | data

file://If the input content is not satisfied, it is not committed, and the focus automatically jumps to that location.
file:// is much more useful than sending the data at the server side after it is sent!

Scripting code:

if (TheForm.title.value = "")
{
Alert ("Please enter a title!") ");
TheForm.title.focus ();
return (false);
}
if (TheForm.detail.value = "")
{
Alert ("Please enter the content!") ");
TheForm.detail.focus ();
return (false);
}
if (TheForm.name.value = "")
{
Alert ("Please enter the author!") ");
TheForm.name.focus ();
return (false);
}
if (TheForm.email.value = "")
{
Alert ("Please enter the mailbox!") ");
TheForm.email.focus ();
return (false);
}

}

-->

HTML page code:

Your name: Your mailbox: Article title:

Article content: Some notes:

file://to take the original literature of the website publishing page.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.