一位同事正在使用 Ipipeline 在框架中显示一些数据。我需要相同的功能并克隆了大部分代码。原始 pgm 在 CS.net 环境中使用母版页,而我在使用用户控件而非母版页的 VB.net 环境中编码。
如果我在浏览器中单独查看 HTM,页面会显示并且下拉列表可以正常工作。但是当我将它嵌入到一个非常简单的页面中的 iframe 标记中并运行时,该页面显示但随后我得到:
Microsoft JScript 运行时错误:单击页面上的第一个下拉列表时对象不支持属性或方法“createContextualFragment”。
这个测试页看起来像:
<body>
<form id="form1" runat="server">
<div>
<iframe id="frame1" src="../Ipipeline/xxxxx.htm"></iframe>
</div>
</form>
</body>
我确实在 StackOverflow article但我认为它不适用,因为这在没有 iframe 的情况下在我的 IE9 机器上工作。
我采取的步骤:
- 我看到默认的 DOCTYPE 不允许使用框架集,所以我将其换成允许使用的框架集,但没有用:行为相同。
有什么建议吗?
最佳答案
我有一个类似的问题,将这个 javascript 添加到我的页面解决了这个问题。 在我的例子中,它与调用 createContextualFragment 的 activewidget 组件有关。我在所有其他 javascript 链接之后声明了这个 javascript,它为我解决了这个问题。
<script type="text/javascript">
if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment)
{
Range.prototype.createContextualFragment = function(html)
{
var frag = document.createDocumentFragment(),
div = document.createElement("div");
frag.appendChild(div);
div.outerHTML = html;
return frag;
};
}
</script>
希望对您有所帮助。
联邦
关于javascript - 对象不支持属性或方法 'createContextualFragment',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8619820/