直接用window.open(url)的话就没办法了。不如试试用iframe
<SCRIPT LANGUAGE="JavaScript">
var OpenWindow
function openwin(url)
{
OpenWindow=window.open("")
var content = "<iframe src='"+url+"' style='width:100%' height='100%'></iframe>";
OpenWindow.document.write("<TITLE>例子</TITLE>" )
OpenWindow.document.write("<BODY style='margin:0'>")
OpenWindow.document.write(content)
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
OpenWindow.document.close()
}
</SCRIPT> <a href="#" onclick="openwin('1.PDF')">打开一个窗口</a>
<input type="button" onclick="openwin('1.PDF')" value="打开窗口">
<input type="button" onclick="OpenWindow.close()" value="关闭窗口">
<SCRIPT LANGUAGE="JavaScript">
var OpenWindow
function openwin(url)
{
OpenWindow=window.open("")
var content = "<iframe src='"+url+"' style='width:100%' height='100%'></iframe>";
OpenWindow.document.write("<TITLE>例子</TITLE>" )
OpenWindow.document.write("<BODY style='margin:0'>")
OpenWindow.document.write(content)
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
OpenWindow.document.close()
}
</SCRIPT> <a href="#" onclick="openwin('1.PDF')">打开一个窗口</a>
<input type="button" onclick="openwin('1.PDF')" value="打开窗口">
<input type="button" onclick="OpenWindow.close()" value="关闭窗口">
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货