2011-12-22 85 views
0

裏面的html如果我有一個具有以下結構如何添加iframe的表單元素

<iframe id="iframesitefileupload" src="IframeTest.aspx" style="margin-left:20px" name="iframesitefileupload"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
     <head> 
     <body> 
      <form id="form1" action="IframeTest.aspx" method="post" name="form1"> 

       //add stuff here ----      

      </form> 
     </body> 
    </html> 
</iframe> 

我如何可以追加內容到形式元素的iframe?

回答

2

你可以訪問與.contents()一個IFRAME:

$('#iframesitefileupload').contents().find('#form1') 
          .append('<div>Hello iframe</div>'); 
-1

IframeTest.aspx產生iframe中的內容,你爲什麼不這樣做呢?