By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,254 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,254 IT Pros & Developers. It's quick & easy.

Event Handling

P: 1
I am doing Event Handling by Javascript

I want to use "onMouseOver" command for filling up a form. I have made a "Dropdown List" in the Form. When a user ignore to select a city from "Dropdown List", I want that a "window.alert" "Please select your city".

I have done this but when I select a city, alert again comes. I want that after selection of city, there should be no alert again. My code is here:

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT>
  2. function checkCityForm()    {
  3.         if ((document.login.Address1.value.length > 0) && (document.login.from.selectedIndex == 0))    {
  4.         window.alert("Select your city Please");
  5.     }        
  6. }
  7. </SCRIPT>
Jun 8 '11 #1
Share this Question
Share on Google+
2 Replies


100+
P: 1,059
you can call the alert under condition
as example:
Expand|Select|Wrap|Line Numbers
  1. var already_checked=false;
  2. function desired_function()
  3. {
  4.  ...
  5.  if(already_checked==false)
  6.  {
  7.   already_checked=true;
  8.   alert("Please you should not miss this chance");
  9.  }
  10.  ...
  11. }
  12.  
Jun 9 '11 #2

P: 8
Why You don't validate form, alert is not very nice for users. You have many jQuery plugins for this.
Jun 22 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.