我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网页设计 > JS特效 > IE5中用JavaScript跨frame加option问题
热门文章排行
热门文章排行 网页上传常见问题分析(11-24)
五彩缤纷建网页(一)(10-11)
五彩缤纷建网页(二)(10-11)
五彩缤纷建网页(三)(10-11)
五彩缤纷建网页(四)(10-11)
精采文章排行
精采文章排行 网页技巧二十例(11-13)
模仿QQ和MSN消息提示的效果(11-13)
根据分辨率不同调用不同的css文件(11-13)
Dreamweaver 基础 :DW的"文档"工具(11-01)
Dreamweaver 基础 :DW的"文档"窗口(11-01)
技术专题推荐
网管论坛交流
 

IE5中用JavaScript跨frame加option问题 

作者:佚名   来源:Linux 宝库   点击:   日期:2006-11-24


-->

  跨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



文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·在状态栏中实现活动文字效果 ·DW+ASP玩转动态二级菜单
·鼠标事件的基础和完美实现 ·DW滑动菜单的制作
·网页里震动的效果怎么做 ·灵活运用DREAMWEAVER的SITE功能

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。