A related question about JS, ask the Master to solve
Source: Internet
Author: User
A question about JS, ask the Master to solve.
I have two JS-written functions:
A function verifies that user input is incorrect, incorrect alert ("error")
Specific as follows:
function A ()
{
if (document.form.username.value! = ") {
Alert ("Error");
return false;
}
}
The A function is then called in the B function:
function B ()
{
return a ();
Form.submit ();
}
In this way, when the commit is called the B function to do other functions, and then call a function, of course, I use the above B function in the way called when the username is empty when there is a hint, the page is not submitted,
The problem is that when username is not empty, page-point submissions have no response or commit.
When I call a function in the B function "Return" is taken out, the input is empty prompt error, and then submitted to the next page, I want to have a problem on this page do not submit, input is not empty to submit to the next page, there is a master to see what the problem????
Thank you
------Solution--------------------
function B ()
{
if (A ()) Form.submit ();
return false;
}
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.