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 / sasi5586



<HTML><HEAD>
<TITLE>drop down validation</TITLE>

<script type="text/javascript">


function validateForm(){
if(document.ItemList.Item.selectedIndex==0)
{
alert("Please select item from first list.");
document.ItemList.Item.focus();
return false;
}
return true;
}

</SCRIPT>
</HEAD>

<BODY>
Please choose an item from the drop down menu:

<form name="ItemList" method="post" action="asp.html"
onsubmit="validateForm()">
<table width="100%" border="0">
<tr>
<td width="135">Choose a username: </td>
<td>
<select name="Item">
<option value selected> SELECT </option>
<option value>Apples</option>
<option value>Oranges</option>
</select>

<table width="100%" border="0">
<tr>
<td width="135">Choose a username: </td>
<td>
<select name="Item" onclick="validateForm()">
<option value selected> SELECT </option>
<option value>Apples</option>
<option value>Oranges</option>
</select>

<input type="submit" name="Submit" value="Submit">
</td></tr></table></form>
</BODY>
</HTML>

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are ‘settimeout()’?

588


What is the difference between registerclientscriptblock and registerstartupscript?

493


How do I retrieve a cookie with a given name using a regular expression?

490


How do I activate javascript on my phone?

492


What do mean by NULL in Javascript?

510






What is difference between array.splice() and array.slice() method in javascript?

492


Do you need to declare variables in javascript?

473


How to set the cursor to wait in JavaScript?

545


What is a name function in javascript & how to define it?

494


What are nodes in javascript?

434


What is lazy loading in javascript?

454


Do I need javascript enabled?

470


What is an object in javascript, give an example?

515


Can you explain how inheritance works in javascript?

526


What are javascript properties?

492