SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript - using javascipt function to check index

    function sindex()
    {
    if (sel_agefrom.SelectedIndex == 0 || sel_ageto.SelectedIndex==0)
    {
    alert ("Select from and to age");
    return false;
    }
    }

    i have above script with dropdown and a command button on page
    the command button has OnClick event which eexecutes code behind

    if the drop down has selected index as 0 the above alert should popup and the onclick shld not get executed


    error
    Microsoft JScript runtime error: 'sel_agefrom' is undefined

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,996
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    The code you posted seems alright.
    Could you post a link to a page where I can see this no working, or a small HTML snippet with which I can recreate the problem.
    Also, which version of IE is it not working in?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •