问题汇总
1.<image>标签显示图片问题:
数据库里保存的url是物理地址,
比如:~\file\2014\8\14\20140814111321042176.jpg,从数据库读取后,直接付给前台Html页面<image src="">标签,
火狐浏览器不会自动转义反斜杠\,谷歌和ie浏览器下都没有问题,此时需要在后台进行replace或者在前台replace:
Url.Replace(@"\",@"/") // C#方法 @进行转义 path = path.replace('\\', '/'); // js方法 也需要转义//
2.easy ui 弹出window窗口,关闭后再弹出其它窗口,页面会先显示上次的内容,然后才加载本次的数据,解决办法是每次关闭窗口时,清空内容:
// 正常弹出窗口的方法 $("#if1").attr("src", src); $("#window").window({ title: title, width: width, height: height, padding: 10, top: ($(window).height()-height) * 0.5, left: ($(window).width() - width) * 0.5 }).window("open"); $('#window').window('refresh');//打开后刷新页面,效果不好 ***************解决办法************************* // 窗口关闭按钮 function Close() { window.parent.closeDialog(); } // 关闭前清空弹出窗口所有内容 function Destroy() { if($("#form1").length>0) $("#form1")[0].innerHTML = ""; } //因为考虑到有时候用户不点击按钮而是点击右上角的叉进行关闭, //我们在父页面增加关闭窗口的监听 $(function () { $('#window').window({ onBeforeClose: function () { if ($("#if1").length > 0) { //判断一下iframe $("#if1")[0].contentWindow.Destroy(); //找到子页面的方法 } } });
这里需要注意的就是父页面找子页面的方法 $("#if1")[0].contentWindow.Destroy(); Destroy()为子页面的方法。
子页面找父页面的方法:window.parent.parentFun();