Web development

Web development

I want to validate textbox based on dropdown menu consisting of many options. For eg Dropdown consists of option (1,2,3,4) if "1" is selected textbox should validate a value 0f "2300" through a submit button "Evaluate". Please give me the sample code for the above problem using only javascript

<HTML>
<SCRIPT>
function validate()
{
var v=document.getElementById("t").value;
var e = document.getElementById("sel");
var st = e.options[e.selectedIndex].text;
if(e=="" && v=="")
{
alert("Please fill in the options.");

}
else if(st=="1"&& v=="2300")
{
alert("Correct answer");

}
else 
{
alert("Incorrect answer");

}
}
}
</SCRIPT>
</HTML>
<form name="f" onsubmit="return validate();">
<pre>
<select id="sel">
<option value="0">Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>

Thanks for the code.. Worked well... According to the above code as soon as we select Evaluate button it shows alert box indicating Correct or Incorrect answer according to the input. But as we close the alert box the input values gets reseted to the original form. Can u please make the required modification? Also I want to implement a condition to show a alert box "Please fill in the option" when both or either of the inputs to drop down menu and textbox are missing. Please help me out with the code. Thank you

View Answers

Ads









Related Tutorials/Questions & Answers:
web development.
web development.  I have designed a website using asp.net in that i have used oracle as database,in that users can upload,view and edit their details.so,how to write code for edit,update and delete button in asp.net
Web development
Web development  I want to validate textbox based on dropdown menu consisting of many options. For eg Dropdown consists of option (1,2,3,4) if "1" is selected textbox should validate a value 0f "2300" through a submit button
Advertisements
Web development
Web development  Please help me formulate code for the following I have three textboxes.The first two textboxes has to carryout Addition or subtraction of two numbers entered and show the result in the third box as soon we take
Web development
Web development  I want to validate textbox based on dropdown menu consisting of many options. For eg Dropdown consists of option (1,2,3,4) if "1" is selected textbox should validate a value 0f "2300" through a submit button
Web development
Web development  I want to validate textbox based on dropdown menu consisting of many options. For eg Dropdown consists of option (1,2,3,4) if "1" is selected textbox should validate a value 0f "2300" through a submit button
Enjoying Web Development with Wicket
Enjoying Web Development with Wicket  Wanted e book Enjoying Web Development with Wicket 3rd edition
What is Web Development?
What is Web Development?  As a end user what arises in your mind. Like "What is Web development". Can any one explain with some examples. Thanks
web development trainee
web development trainee  How to store data and retrieve the stored data pleas give me details with examples
Ajax web development
Ajax web development  Hi, Why I should use Ajax frameworks in Ajax Web development? Thanks   Hi, Without the use of any Ajax framework you can also develop ajax based web applications. But the development effort
Web Development for iPhone
Web Development for iPhone Developing Web apps for iPhone or any other mobile phone is a different task and not so easy as developing web apps..., an esteemed Delhi based software development company is quite capable of creating web
web component development
web component development  sir ineed objectives type questions
web component development
web component development  sir ineed objectives type questions
Web-based system development
Web-based system development  I have a system written in java application.my lecturer asks me to do in web-base. what should i do?what should i have and what should i know? i have read that the best architecture is 3-tier
Web development - Introduction
Web development - Introduction       Web development in general term is process of developing... content development, client-side/server-side scripting, and web server
Web Page design and Development Company
Web Page design and Development Company We are web page designing... the world. Web page design and development is an art and skilled developers can create... complete web page design and development solution. Our company is expert
Web Application Development in India, Web Application Development
Web Application Development in India Develop your Web Applications in India... customised web application development services to you. With our industry..., MySQL, ASP, PHP, etc our web application development services are always tuned
PHP Web Development Company in India
PHP Web Development Company in India PHP is ultimate technology for developing.... If you are looking for PHP Web Development Company in India, then you have reached right place. We offer PHP Web Development Company in India at very cost
PHP Web Development Company in India
PHP Web Development Company in India PHP is ultimate technology for developing.... If you are looking for PHP Web Development Company in India, then you have reached right place. We offer PHP Web Development Company in India at very cost
PHP Web Development Company in India
PHP Web Development Company in India PHP is ultimate technology for developing.... If you are looking for PHP Web Development Company in India, then you have reached right place. We offer PHP Web Development Company in India at very cost
Summer Internship Program for Web Development and Web Design
Summer Internship Program for Web Development and Web Design - Rose India... looking to enroll in an internship program for web  development and web... and knowledge in web development and design beside introducing you with the latest
Web Development in India,Web Development in India Outsourcing
Web Development in India Web Development in India - Outsource Web Development in India Web Development and designing is a highly structured work due... attract user at once. Rose India is a Web Development Company in India
Web Application Development,Web Application Development India
Web Application Development Solutions India Web Application Development... web application development solutions that are reliable, scalable and robust. Rose India offers the following Web Application Development Solutions
Ajax as Web application Development
Ajax as Web application Development       AJAX is a web application development technique which... Style Sheet) is used in web site for designing purpose, we can use CSS in almost
Top 10 Web Development Languages
Top 10 Web Development Languages For a web designer or a web developer a grasp on few most crucial web development languages is a must as they are the very materials of their web development project. While some of these web development
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
Symfony Framework for PHP Web Application Development
Symfony Framework for PHP Web Application Development Symfony is the most crucial framework for PHP web application development, which is distributed under... open source or commercial web application development. Symfony Framework has
Web Development Services,Web Design Development Services,Website Developement Services India
Web Development Services RoseIndia.net is a specialize software firms.../server platform as well as web domain. First of all we do study and understand.... We follow the following steps of software development process
Top 10 Web Development Skills You Need
conversion comes. To talk about top 10 web development skills you need we face... preferred web development skills. SEO SEO or search engine optimization... going to acquire other web development skills. HTML 5, the latest version
Key Reasons to Use Angular for Web App Development
AngularJS Tutorials: Key Reasons to Use Angular for Web App Development Years... of development projects. Since then, AngularJS continued to evolve and become richer... development Angular offers a complete package of tools and all required features
Top 10 Web Development Skills
Top 10 Web Development Skills For an ambitious web developer or web designer... in career as a developer or designer. To talk of top 10 web development skills we... of internet access. Web development skills of highest demand went through multiple

Ads