Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Where javascript variables are stored?

985


What is argument objects in javascript & how to get the type of arguments passed to a function?

973


What is triple dot in javascript?

929


How to remove duplicates from javascript array?

942


What does window.print() do in Javascript?

986


List out all the falsifying tokens in Javascript?

1066


In javascript what is an argument object?

1498


How to get value from dropdown (select) control?

1009


What are javascript functions?

860


How to embed javascript in a web page?

864


What is output of “20” + 20 + 20 and “20” + ( 20 + 20)? In javascript?

955


Explain how to read and write a file using javascript?

913


How do you change the style/class on any element using javascript?

876


What happens when the recursion calling is applied on two functions?

1030


What are a fixed-width table and its advantages in javascript?

861