hi i want validations for two dropdown lists in java
script.when user enter to second dropdown list by skipping
first dropdown list we should get alert box. please help me
very urgent
Answer Posted / upendar
<html>
<head>
<script type="text/javascript">
function validateform(){
var selObj =
document.getElementById('firstDrDn').selectedIndex;
if(selObj == 0)
{
alert("please select item from first list.");
document.getElementById('firstDrDn').focus();
return false;
}
return true;
}
</script>
</head>
<body>
<h2> Choose An Item From The Drop Down Menu: </h2>
<select name="item" id="firstDrDn">
<option value="0"> Select </option>
<option value="1">Bananas</option>
<option value="2">Mangoes</option>
</select>
<select name="item" id="secondDrDn"
onclick="validateform()">
<option value="0"> Select </option>
<option value="1">Apples</option>
<option value="2">Oranges</option>
</select>
</body>
</html>
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is array an object javascript?
What is the purpose of 'this' operator in JavaScript?
List html dom mouse events?
how to run the servlet in tomcat
I am providing the Online& class room training on Worksoft Certify for SAP/HTML/JAVA using real time scenarios in a real time environment for a real time project, If any one is interested please get in touch with me on aimansaud@gmail.com
What is difference between callback and promise?
Explain few difference between null, undefined or undeclared javascript variable?
What is scope chain in javascript?
How to submit a form using JavaScript by clicking a link?
Which built-in method returns the length of the string?
What does 3+4+"7" evaluate to?
What is callback in javascript?
How fast can you learn coding?
What does the delete operator do?
Define unescape() function?