How to set focus to a control inside frame

Posted by Geetha on Stack Overflow See other posts from Stack Overflow or by Geetha
Published on 2010-06-05T06:33:58Z Indexed on 2010/06/05 6:42 UTC
Read the original article Hit count: 141

Filed under:
|
|

Hi All,

i am using two frames in a page. Mainframe have a page with text box to get input and gives the result url.

Needs:

  1. I want to show this page in the topframe.
  2. I want to set focus to the text box control in the mainframe always. using the following code but giving null error.

    parent.frames['mainFrame'].document.getElementById('form1:txtbox').focus();

    <frameset rows="550,0" cols="1008" frameborder="NO" border="0" framespacing="0">  
     <frame src="" id="topFrame" target="topFrame" runat="server"  scrolling="no"></frame>
     <frame src="Search.aspx" runat="server" id="mainFrame"></frame>     
    </frameset>
    

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript