Can';使用javascript设置HTML对象元素的数据属性
以下内容适用于当前Firefox(PDF加载),但不适用于当前IE(页面为空白)。有什么建议吗Can';使用javascript设置HTML对象元素的数据属性,javascript,html,Javascript,Html,以下内容适用于当前Firefox(PDF加载),但不适用于当前IE(页面为空白)。有什么建议吗 <head> <script type="text/javascript"> function startup() { var bubba = document.getElementById('bubba'); bubba.data = 'http://server.qa/test.pdf';
<head>
<script type="text/javascript">
function startup() {
var bubba = document.getElementById('bubba');
bubba.data = 'http://server.qa/test.pdf';
}
</script>
</head>
<body onload="startup();">
<object id="bubba" type="application/pdf" width="80%" height="800">
No PDF reader installed
</object>
</body>
函数启动(){
var bubba=document.getElementById('bubba');
布巴数据中心http://server.qa/test.pdf';
}
没有安装PDF阅读器
您将无法像那样显示PDF。IE和Foreox之间包含插件的语法不同
我建议使用
而不是
,并使用JavaScript设置iframe的src
属性。这应该调用浏览器中安装的PDF插件,如果没有,则下载PDF