focus on dropdownlist using javascript

Last post 11-06-2008, 1:13 AM by jyoshnnaraj. 2 replies.
Sort Posts: Previous Next
  •  11-06-2008, 12:29 AM Post number 70367

    focus on dropdownlist using javascript

    hi

    i want a aspx form in that im having a dropdownlist and other server controls

    when my page first loads i want my dropdownlists hould get focussed

    i had write a javascript code but it is nt working

    Page.RegisterStartupScript("SetFocus","<Script>document.getElementById('" + DdlZone.ClientId + "');</Script>");

    but my dropdown is not getting highlighted

    plz help me!

  •  11-06-2008, 12:34 AM Post number 70368 in reply to post number 70367

    • Damon is not online. Last active: 12-02-2008, 6:48 PM Damon
    • Top 10 Contributor
    • Joined on 06-26-2006
    • Dallas, TX
    • Acorn Archimedes

    Re: focus on dropdownlist using javascript

    When you call document.getElementById() it gets a reference to the element in the document.  But once you get that reference, you're not doing anything with it.  You probably need something like

    Page.RegisterStartupScript("SetFocus","<Script>document.getElementById('" + DdlZone.ClientId + "').focus();</Script>");

     


    Damon Armstrong, Technology Consultant
    [Blog] [Articles]
  •  11-06-2008, 1:13 AM Post number 70369 in reply to post number 70368

    Re: focus on dropdownlist using javascript

    thank u

    i got it

View as RSS news feed in XML