When I execute this code:
<!DOCTYPE html>
<html>
<head>
<script language="javascript">
function foobar() {
alert(document.getElementById("myPdf"));
}
</script>
</head>
<body>
<object id="myPdf" type="application/pdf" data="file.pdf"></object>
<input type="button" value="Click" onClick="return foobar();">
</body>
</html>
[object] HTMLObjectElement
is alerted.
But doing the same thing with Dart Polymer in combination with dart:js, ie the object-element is added to the DOM via Dart Polymer and the javascript code is executed via context.callMethod("foobar")
, only [object] Object
is alerted. Why is this the case? How to get the more specific HTMLObjectElement in this case?
我自己找到了解决方案:对象具有属性“ impl”,其中存储了HTMLObjectElement。
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.