首页 电脑 电脑学堂 查看内容

js复制到剪切板

2012-5-4 09:23 591 0

摘要: Javascript代码 function copytoclip(obj)  {  var objtest=obj.innerText; &...
关键词: nbsp objtest clipboardData copytoclip Javascript innerText obj sharpleo function setData

现在使用的版本 extjs3.3.1 在extjs中window加载的是一个jframe,而iframe中引入了js,在这个时候js不能运行,但是在火狐中是OK的,在IE6.0(开发中一般会使用IE6.0)不可以加载js, 这个问题需要你加载完成之后重新reload()一下即可 [javascript] var myHtml='<iframe id="ifrm008" name="ifrm008" scrolling="auto" frameborder="0" width="100%"height="100%" src="/his/inpatient!detailUI.action{0}"></iframe>';     myHtml=myHtml.replace('{0}',params);    // alert(myHtml); 测试打印输出         //new 窗体显示结果   this.detailWin=new top.Ext.Window({         title: "医院住院病人住院明细",          layout:'fit',          height: 600,       width: 800,          closeAction:'hide',          plain: true,          modal : true,          listeners:{             afterrender:function(window){                 //加载数据,刷新数据                  //alert(top.frames['ifrm001'].location);                  top.frames['ifrm008'].location.reload();                 //var mysrc=self.document.getElementById('ifrm001').src;                  //document.getElementById('ifrm001').src=mysrc;              }          },          html : myHtml       });    var myHtml='<iframe id="ifrm008" name="ifrm008" scrolling="auto" frameborder="0" width="100%"height="100%" src="/his/inpatient!detailUI.action{0}"></iframe>';       myHtml=myHtml.replace('{0}',params);      // alert(myHtml); 测试打印输出          //new 窗体显示结果 www.2cto.com    this.detailWin=new top.Ext.Window({           title: "医院住院病人住院明细",            layout:'fit',            height: 600,         width: 800,            closeAction:'hide',            plain: true,            modal : true,            listeners:{             afterrender:function(window){              //加载数据,刷新数据              //alert(top.frames['ifrm001'].location);              top.frames['ifrm008'].location.reload();              //var mysrc=self.document.getElementById('ifrm001').src;              //document.getElementById('ifrm001').src=mysrc;             }            },            html : myHtml         });上面replace('{0}',params);是参数; 在以上代码中在IE和火狐中运行都是OK的,[javascript] top.frames['ifrm008'].location.reload(); top.frames['ifrm008'].location.reload();用这个进行重新加载显示页面,extjs加载后js不会执行,所以需要使用reload重新加载窗体 摘自 yhc13429826359的专栏 
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部