我面臨打印iframe內容的問題。onclick打印iframe內的內容
這是在iframe外錨標記:
<a href=」#」 onclick='window.print()' >Print</a>
,這裏是我的iframe
<iframe name="newtest" src="https:xyz.com" ></iframe>
我要打印的是錨標記的點擊的iframe是外內頁iframe
我面臨打印iframe內容的問題。onclick打印iframe內的內容
這是在iframe外錨標記:
<a href=」#」 onclick='window.print()' >Print</a>
,這裏是我的iframe
<iframe name="newtest" src="https:xyz.com" ></iframe>
我要打印的是錨標記的點擊的iframe是外內頁iframe
<iframe src="" id="iframeid"></iframe>
document.getElementById("iframeid").contentWindow.print();
如果您嘗試打印遠程站點,則無法以任何方式執行此操作。
如果你是http://yoursite.org
和iframe是<iframe src="http://google.com">
你不能做到這一點,網站域名必須匹配
代替如果頁面<iframe src="page.htm">
本地頁面,將工作
檢查,這可能幫助你的http: //stackoverflow.com/questions/6906047/printing-iframe-content-with-jquery –