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
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 decodeuri() function?
What is javascript? List some data types supported by javascript?
Who is the world famous hacker?
What is a reverse string?
How do I activate javascript on my phone?
Name some of the built-in methods and the values returned by them.
What is the syntax of ‘self invoking function’? Give an example?
What is servlet in javascript?
What does e mean in a function?
Are Typescript and Javascript the same?
How to create array in JavaScript?
What are types of javascript?
What is a null variable?
Explain with an example the use of event handlers in javascript.