MCQs > IT & Programming > JavaScript > In an HTML page, the form tag is defined as follows:
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

JavaScript MCQs

In an HTML page, the form tag is defined as follows:
<form onsubmit="return Validate()" action="http://www.mysite.com/">
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answer

Correct Answer: <script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return false; else return true; } </script>

Explanation:

Note: This Question is unanswered, help us to find answer for this one

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it