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
Why would you use a sticky session?
What exactly does javascript do?
Can I learn javascript without html?
What is the difference between typeof and instanceof operators in Javascript?
Please write the Code of simple javascript calculator withot eval() function
How is it possible to get the total number of arguments that are passed to a function?
What is argument objects in javascript?
Why javascript is called as script for all browsers?
Where is javascript used most?
Is javascript backend or frontend?
What is a null variable in javascript?
What are the scopes of a variable in javascript?
What is the use of ‘debugger’ keyword in javascript code?
name any two javascript functions which are used to convert nonnumeric values into numbers?
What is strict mode in javascript?