Event Handling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arif Shah
    New Member
    • Jun 2011
    • 1

    #1

    Event Handling

    I am doing Event Handling by Javascript

    I want to use "onMouseOve r" 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.ale rt" "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:

    Code:
    <SCRIPT>
    function checkCityForm()	{
    		if ((document.login.Address1.value.length > 0) && (document.login.from.selectedIndex == 0))	{
    		window.alert("Select your city Please");
    	}		
    }
    </SCRIPT>
    Last edited by Dormilich; Jun 8 '11, 08:55 PM.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    you can call the alert under condition
    as example:
    Code:
    var already_checked=false;
    function desired_function()
    {
     ...
     if(already_checked==false)
     {
      already_checked=true;
      alert("Please you should not miss this chance");
     }
     ...
    }

    Comment

    • macem
      New Member
      • Jun 2011
      • 8

      #3
      Why You don't validate form, alert is not very nice for users. You have many jQuery plugins for this.

      Comment

      Working...