浏览器兼容性
来源:互联网 发布:c语言接口与实现 编码 编辑:程序博客网 时间:2024/05/19 13:26
1、模态窗体的关闭调用函数closeModalDialog(retValue),这个函数在util.js里
2、要取得返回值,打开模态窗体后要加一句话,如下:
var ret = window.showModalDialog(url, window, WindowStyle);
if (ret == undefined){
ret = window.returnValue;
}
3、chrome浏览器下,需要从模态窗体获取值的(如选择用户)
原来是 window.returnValue = retValue+"||"+retName;
要改成
if (window.opener != undefined){
if (window.opener.document.all("<%=request.getParameter("userID")%>") != undefined)
window.opener.document.all("<%=request.getParameter("userID")%>").value=retValue;
if (window.opener.document.all("<%=request.getParameter("userName")%>") != undefined)
window.opener.document.all("<%=request.getParameter("userName")%>").value=retName;
}else{
window.returnValue = retValue+"||"+retName;
}
二、JS到服务器端取值(必须IE7.0以上)
原来写法是:var httpob = new ActiveXObject('Microsoft.XMLHTTP'); 或者 var httpob = new ActiveXObject("Microsoft.XMLHTTP");
或者 var httpob=new ActiveXObject('Microsoft.XMLHTTP');
httpob.Open
要改成 - var httpob = new XMLHttpRequest();
httpob.open
三、列表复选框选择,这些复选框都是只有name,没有id的
原来写法是:document.Form1.item(n)
要改成 document.getElementsByName(n)[0]
四、打开窗体大小,包括卡片变动、详情等地方
原来写法是:
var ChildWin=window.open(url,"","width="+screen.width+",height="+screen.height+",top=50,left=50,scrollbars=yes,resizable=yes");
ChildWin.resizeTo(screen.availWidth-100,screen.availHeight-100);
ChildWin.moveTo(50,50);
在有些浏览器下无法获取screen.availWidth,会导致打开的窗体很小
要改成
var width=1000;
var height=750;
if (screen.availWidth > 0){
width=screen.availWidth-100;
}else if (screen.width > 0){
width=screen.width-100;
}
if (screen.availHeight > 0){
height=screen.availHeight-100;
}else if (screen.height > 0){
height=screen.height-100;
}
var ChildWin=window.open(url,"","width="+width+",height="+height+",top=50,left=50,scrollbars=yes,resizable=yes");
坚决不发:
new String(request.getParameter("HCMC").getBytes("ISO-8859-1"),"UTF-8");
<!DOCTYPE html><!--STATUS OK--><html><head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
用到ajax的地方 有那份txt下载
<script language="JavaScript" src="../../pub/WdatePicker/WdatePicker.js"></script>
<script language="javaScript" src="../pub/js/util.js"></script>
onclick="closeWindow()"
openUserTree
+"&userID="+userID+"&userName="+userName;
删除范例:
<script language="javaScript" src="../../pub/js/util.js"></script>
if (window.opener != undefined) {
window.opener.Form1.submit();
window.close();
}else{
closeModalDialog("2");
}
function btn_close(){
if(window.opener != undefined) {
window.opener.Form1.submit();
window.close();
}else{
closeModalDialog("2");
}
}
function sucClose(){
if (window.opener != undefined) {
alert("aa");
var pagesize=document.getElementById("pagesize").value;
window.opener.Form1.action="ListPage_sysjf.jsp?wid=&active=2&tp=ZC_BMNDJC&curpage=1&pagesize="+pagesize;
window.opener.Form1.submit();
window.close();
}else{
alert("bb");
closeModalDialog("2");
}
}
function backList(){
window.close();
parent.left.xtggcx_query();
}
IE刷新页面
document.Form1.action = "#";
document.Form1.submit();
<script type="text/javascript">
function confirm_zcfl(){
var lbbh=document.getElementById("LBBH").value;
if(lbbh.indexOf(";")!=-1){
lbbh = lbbh.substring(0,lbbh.indexOf(";"));
}
if (myBrowser() == "Chrome"){
if (window.parent.opener.document.getElementById("LBBH") != undefined)
window.parent.opener.document.getElementById("LBBH").value=lbbh;
window.parent.close();
}else{
closeModalDialog(lbbh);
}
}
function close_zcfl(){
if (myBrowser()== "Chrome") {
window.parent.close();
}else{
window.close();
}
}
</script>
<script type="text/javascript">
function confirm_sfl(){
var lbbh=document.getElementById("LBBH").value;
var lbbhmc=document.getElementById("LBBHMC").value;
if(lbbh.indexOf(";")!=-1){
lbbh1 = lbbh.substring(0,lbbh.indexOf(";"));
}
if(lbbh.indexOf(";")!=-1){
lbbhmc = lbbh.substring(lbbh1.length+1);
}
if(lbbh.indexOf(";")!=-1){
lbbhmc = lbbhmc.substring(0,lbbhmc.indexOf(";"));
}
if (myBrowser() == "Chrome"){
if (window.parent.opener.document.getElementById("XYBH") != undefined){
window.parent.opener.document.getElementById("XYBH").value=lbbh1;
}
if (window.parent.opener.document.getElementById("MC") != undefined){
window.parent.opener.document.getElementById("MC").value=lbbhmc;
}
window.parent.close();
}else{
closeModalDialog(lbbh);
}
}
function close_sfl(){
if (myBrowser()== "Chrome") {
window.parent.close();
}else{
window.close();
}
}
</script>
function btn_close(){
if (myBrowser()== "Chrome") {
window.parent.opener.Form1.submit();
window.parent.close();
}else{
closeModalDialog("<%=refresh%>");
}}
<input class="BUTTON" type="button" value="关 闭" onclick="closeModalDialog()">
4//"审核不通过"的事件
var auditingAgainst_ret = null;
function auditingAgainst(msgIsReadID){
document.all.audAgainst.disabled=true;
var WindowStyle="dialogHeight:240px; dialogWidth:450px; status=no; center:yes; resizable:yes; help:no";
var url="auditingPupDialog.jsp?msgIsReadID="+msgIsReadID;
var ret=window.showModalDialog(url,window,WindowStyle);
if (ret == undefined){
ret = window.returnValue;
}
if(ret){
if(ret=="false"){
document.all.audAgainst.disabled=false;
return;
}
auditingAgainst_submit(msgIsReadID);
} else {
var aa = setInterval(function(msgIsReadID) {
if (!(null == auditingAgainst_ret || undefined == auditingAgainst_ret)) {
//document.write(auditingAgainst_ret);
auditingAgainst_submit(msgIsReadID);
clearInterval(aa);
}
}, 100, msgIsReadID);
}
}
function auditingAgainst_submit(msgIsReadID){
document.all.operator.value="auditingAgainst";
if ("Chrome" == myBrowser()) {
document.all.reason.value=auditingAgainst_ret;
} else {
document.all.reason.value=ret;
}
document.Form1.action = "bzdxxEditSave.jsp?msgIsReadID="+msgIsReadID;
document.Form1.target = "_self";
document.Form1.submit();
}
<td><a style="cursor:hand" onclick="reOrder('ZDBH')">字典编号</a></td>
<td><a style="cursor:hand" onclick="reOrder('ZDBH')">字典编号</a></td>
//去除字符串的前后空格
function lrtrim(str){
if(str!=undefined||str!=null){
while((str.length>0) && (str.charAt(0)==' '))
str = str.substring(1,str.length);
while((str.length>0) && (str.charAt(str.length-1)==' '))
str = str.substring(0,str.length-1);
}else{str="";}
return str;
}
导出
SetUniCode
给wid添加 ‘’
String widStr = "";
ArrayList wid_arr=new ArrayList();
com.ekingstar.zcgl.bean.StringSplit ss = new com.ekingstar.zcgl.bean.StringSplit();
String stkt[] = ss.splitStr(kpbdwidstr,",");
if(!(stkt == null)){
for (int k = 0;k < stkt.length; k++){
wid_arr.add(k,stkt[k].toString());
}
}
for(int n =0 ;n<wid_arr.size();n++){
widStr+="'"+wid_arr.get(n).toString()+"',";
}
if(widStr.length()>0){
widStr = widStr.substring(0,widStr.length()-1);
}
function sucClose(){
alert("代办人设置成功!");
if (myBrowser() == "Chrome"){
if(window.opener != undefined) {
window.opener.parent.left.NQuery();
window.close();
}
}else{
closeModalDialog("2");
}
}
如果谷歌无法关闭 可能是编辑页面
跳转的时候没有这样写
document.Form1.action = "bzdxxEditSave.jsp?fromzclx="+fromzclx+"&sfsyctj="+sfsyctj+"&sub_mit="+sub_mit;
document.Form1.target = "_self";
document.Form1.submit();
编辑页面的保存(这样的写法是错误的)
var url="dbrsz_Save.jsp?dbrbh="+document.all.hidProxy.value+"&yhbh="+document.all.yhbh.value+"&ywbh="+document.all("ywbh").value+"&t=" + timstamp;;
var ret=window.showModalDialog(url,setRead,WindowStyle);
if (ret == undefined){
ret = window.returnValue;
}
if(ret){
if(ret==2){
window.returnValue=2;
window.close();
}
}
}
IE提交的方式 document.form1.submit();
谷歌提交的方式 window.opener.document.form1.submit();
if (window.opener != undefined){
window.parent.opener.form1.action="ndjh_addPage.jsp?widstr="+selewid;
window.parent.opener.form1.submit();
}else{
window.returnValue = selewid;
}
注意;parent在前在后好像无所谓
注意: window.parent.parent.parent.opener默认为最近一个父窗体
out.print("<script> if(window.opener != undefined) { window.opener.Form1.submit();window.close();}else{closeModalDialog('2');}</script>");
一个方法也要加window.parent.opener.getBmbh();
刷新父窗口
window.opener.location.reload();
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 浏览器兼容性
- 兼顾浏览器兼容性标准
- CSS浏览器兼容性
- ubuntu awk命令
- 挂载
- BZOJ 2733: [HNOI2012]永无乡
- IntelliJ IDEA护眼设置
- python ImportError: DLL load failed: %1 不是有效的 Win32 应用程
- 浏览器兼容性
- ELF文件
- 数据类型---终章
- 项目实战:浅谈属性动画(2)-动画监听事件,消失的按钮,酷炫Path2.0
- HAProxy
- 计算特定字符串的在一个字符串中的个数
- js中几种实用的跨域方法原理详解
- java中volatile关键字解说
- Java获取系统当前时间不正确