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
A cross browser solution...
To get the Document of the iframe:
Quote:
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
Quote:
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);}