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


Please Help Members By Posting Answers For Below Questions

Why would you use a sticky session?

697


What exactly does javascript do?

749


Can I learn javascript without html?

697


What is the difference between typeof and instanceof operators in Javascript?

760


Please write the Code of simple javascript calculator withot eval() function

1667


How is it possible to get the total number of arguments that are passed to a function?

743


What is argument objects in javascript?

674


Why javascript is called as script for all browsers?

656


Where is javascript used most?

656


Is javascript backend or frontend?

624


What is a null variable in javascript?

683


What are the scopes of a variable in javascript?

720


What is the use of ‘debugger’ keyword in javascript code?

667


name any two javascript functions which are used to convert nonnumeric values into numbers?

651


What is strict mode in javascript?

719