dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: form within iframe undefined

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Unhappy form within iframe undefined

    I have a form with two iframes,one at the top and other below it.I want to disable the form inside the bottom iframe through javascript.I tried using getelementbyid of the form but returns undefined error message.Able to access the iframe but the form is not recognised.Can anyone help me with this

  2. #2
    Join Date
    Feb 2012
    Location
    youTUBE
    Posts
    234

    A cross browser solution...

    To get the Document of the iframe:
    function wCONTENTS (TAGname){ var tag=0;
    tag =document.getElementById(TAGname); if (! tag)return(0);
    return((tag.contentDocument?tag.contentDocument:eval('window.document.'+TAGname+'.document')));
    return (0);}
    To submit or other thngs
    function sFORM (iframeNAME,formNAME){
    var myIFRAME =wCONTENTS(iframeNAME);if(! myIFRAME )return(false);

    var f12 =myIFRAME .getElementById(formNAME);
    if(f12)f12.submit(); // or whatever else
    return(false);}

  3. #3
    Join Date
    Jan 2011
    Location
    United Kingdom, London
    Posts
    117
    Is content of those iframes located on different domain? If it is then you have crossdomain problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles