怎么样在IE中实现窗口间操作下拉选框的选项?
怎么样在IE中实现窗口间操作下拉选框的选项?
在b/s系统中,用户经常需要打开子窗口选中某些项目,并将这些项目插入到父窗口的下拉选框中。本来以为在IE中实现这样子窗口操作父窗口的功能十分简单,但是按常规的做法却是行不通的。在google上搜索了一阵也没有好的解决方案。最后看到国外的一个网页上有以下内容:
Explorer 5.0 problems
When it comes to dynamically generating options and selects, Explorer 5.0 on Windows has quite a few problems:
- Generating options in another frame or window doesn't work. Put the script in the page that contains the select. I have heard, but did not test, that this problem still exists in Explorer 6.0
-
Generating selects and options through the 'pure' W3C DOM (ie. with any
document.createElement()
) crashes Explorer 5.0 . Solved in 5.5
Generate these selects and options throughinnerHTML
instead. - Generating options from a popup window may crash any Explorer Windows.
I have heard, but did not test, that the script below works fine in IE 5.0:








最后得到了启发,从而实现了这个功能,下面所有可能用到的实现方法的代码。但是在这些代码中有些方法是不可行的。最后有一个表格说明了哪些方法不可行,理由是什么?
HTMLPage.htm





































HTMLPage2.htm








































































































方法表格
showModalDialogWithoutArg |
InsertToParent |
不能实现 |
子窗口parent属性为子窗口自身 |
InsertToOpener |
不能实现 |
<font size=" |