简体   繁体   English

在IE中查找而不在用innerHTML设置的DIV中查找

[英]Find in IE not looking in DIV set with innerHTML

I have a page with 3 DIV's on them, one with a header, one with a selection-list and the third will get filled with data once something is selected in the selection-list. 我有一个页面,上面有3个DIV,一个带有标题,一个带有选择列表,一旦在选择列表中选择了某些内容,第三个将填充数据。
When something is selected, code like 选择某些内容后,代码如下

document.getElementById("fields").innerHTML='<object type="text/html" data="' + fieldsPage + '" style="width:70%;height:90%" ></object>';

is executed, filling the DIV with the contents of another (generated) page. 被执行,用另一个(生成的)页面的内容填充DIV。
I can view the page fine in Chrome and IE, but... 我可以在Chrome和IE中正常查看页面,但是...

...when I search for something, Chrome finds it even in the DIV filled through innerHTML, but IE doesn't. ...当我搜索某些内容时,Chrome甚至可以在通过innerHTML填充的DIV中找到它,但IE找不到。
IE seems to only search in the header and selection-list DIV's. IE似乎只在标题和选择列表DIV中搜索。
Any suggestions to get IE to search the whole page as well? 有什么建议也可以让IE搜索整个页面吗?

Try this: 尝试这个:

var node = document.createElement ("object");
node.type = "text/html";
node.data = fieldsPage;
node.style.width = "70%";
node.style.height= "90%";
document.getElementById("fields").innerHTML = "";
document.getElementById("fields").appendChild(node);

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM