IE5中用JavaScript跨frame加option问题
来源:互联网 发布:掏耳 知乎 编辑:程序博客网 时间:2024/05/18 14:11
跨frame加option,以下代码在IE5中会出错,但在IE4、IE6、Opera6、NNx中都没有问题:
<script>
function addOption(aSelect, optionId, optionName) {
newOption = new Option(optionName, optionId);
aSelect.options[aSelect.options.length] = newOption;
}
</script>
这样才是对的:
<script>
function addOption(aSelect, optionId, optionName) {
ownerWindow = aSelect.document.parentWindow;
ownerWindow.newOption = new Option(optionName, optionId);
aSelect.options[aSelect.options.length] = ownerWindow.newOption;
}
function crossFrameAddOption() {
var aSelect = parent.otherFrameName.document.forms[0].theSelectName;
addOption(aSelect , "id"+ aSelect.options.length, "name"+ aSelect.options.length);
}
</script>
<input type="button" onClick="crossFrameAddOption();" value="test">
微软的解释如下: In general, at least in the older browser versions, performance seems to improve if you call methods on the target frame if they are stored there as well. This is particularly relevant when trying to add options to a select box in another frame. Make sure you create the option in that other frame so you are adding it to a local select box, instead of trying to cross frame boundaries.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/Webteam02052002.asp
- IE5中用JavaScript跨frame加option问题
- IE5中用JavaScript跨frame加option问题
- select中option加事件问题
- php中用frame写后台首页出现空白问题
- Apache 处理 X-Frame-Option
- javascript中用数组sort排序问题
- IE5/IE6下最小高度问题
- Javascript中清除Select的Option的问题
- unrecognized command line option "-frame-pointer"解决方法
- javascript select option
- select option javascript
- JavaScript Option处理
- javascript option操作
- 【JavaScript】select选中Option
- JavaScript中用解决document.getElementsByName不能获得对象的问题
- 项目中用javascript操作DOM遇到的问题
- <html:option></html:option>转化成<option></option>时加了selected属性
- javascript frame 刷新
- asp.net 与解压缩
- 取消IE打印时出现的页眉和页脚
- CString与数据类型的转换方法
- 为什么要做一个程序员?
- 当今职场上广为流传的十大精辟语录
- IE5中用JavaScript跨frame加option问题
- 手机模拟视频的实现
- 常用声音判断电脑故障
- 《人民邮电出版社9本计算机教材的教学课件(计算机老师的宝贝)》[ISO]
- 2004年三级PC技术考试大纲
- Eclipse编程技术与实例-附CD-ROM光盘
- Linux 内核编译详解
- 提高ASP.Net应用程序性能的十大方法
- 摄像头安装指南( spca5xx)