简体   繁体   中英

accessing hidden element from iframe when page submited

I have a question like this. I have 2 pages in my web for example and page 1 when submited goes to page 2, and of course with it all its html form elements. My question here is i have an iframe in page1 so how to i send the hidden elements from the iframe to page 2 when( page1 is submited)

try this script

<script language="JavaScript" type="text/javascript">

 function fun(iframeid,iframename){
  obj=document.getElementById(iframeid);
   if (obj.tagName=='IFRAME'){
   obj=window.frames[iframename].document.getElementId('myfield1ID').value;

  }
 }
 </script>

and then put the values in page1 hidden element and submit the page...

before the end of script

         document.getElementById('page1hiden').value=obj.value;

this script functiopn you must call it when presing the button to submit the page 1 to p2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM