How to set focus on a textbox in a framed page (the page is loaded in a frame).

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sampath Athreya

    How to set focus on a textbox in a framed page (the page is loaded in a frame).

    This is my javascript file
    Code:
    function signin_check()
    {
    	var e_id=document.getElementById("abcd");
    	var paswd=document.getElementById("bcd");
    
    	if(e_id.value=="")
    	{
    		alert("Please enter your username/email address");		
    		e_id.focus();
    	}
    	else if(paswd.value=="")
    	{
    		alert("Please enter the password");
    		paswd.focus();
    	}
    	else
    	{
    		var a=document.getElementById("signinform");
    		a.setAttribute('action', 'home.xhtml');
    	}
    
    }
    .focus() doesnt seem to work
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    is the script located in the iframe too or is it in the parent page?

    Comment

    • Sampath Athreya

      #3
      The script is in a separate .js file. The file is called from the page where the textbox is located.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        so the js file is included in the page that is loaded in the iframe -> does any error occur in FF error console? when is the function called exactly ...

        Comment

        • Sampath Athreya

          #5
          I'm not sure i understand the error console u mentioned.. And its not iframe. The frames are implemented using frameset tags. The function is called when i click on a submit button... Basically doing form checking.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            in fiefox click on extras -> Error console ... scroll down to the and and tell what error is displayed?

            kind regards

            Comment

            Working...