Javascript-is commonly used to validate user input

Source: Internet
Author: User
Tags button type


JavaScript is the most popular programming language in the world.

The language can be used in HTML and the Web, and is more widely used in servers, PCs, laptops, tablets and smartphones.



JavaScript is a scripting language

JavaScript is a lightweight programming language.

JavaScript is a programmatic code that can be inserted into an HTML page.

When JavaScript is inserted into an HTML page, it can be performed by all modern browsers.

JavaScript is easy to learn.


Commonly used to validate the user's input:

<! DOCTYPE html>

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<center>
<body>
<p> Please enter a number. If the input value is not a number, the browser pops up the prompt box. </p>
<input id= "Demo" type= "text" >

<script>
function MyFunction ()
{
var X=document.getelementbyid ("Demo"). Value;
if (x== "" | | IsNaN (x))
{
Alert ("Not Numeric");
}
</script>

<button type= "button" onclick= "MyFunction ()" > Click Start </button>
</body>
</center>

Javascript-is commonly used to validate user input

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.