Chrome 适配 IE

location.href
-->
location
-------------------------------------------------------
window.showModalDialog
-->
window.open


//document.getElementById('name').innerText = window.dialogArguments;
  document.getElementById('name').innerText = parent.jQuery.dialogArguments;
function sendResult() {
    var team = document.getElementById('team');
    //window.returnValue = team.options[team.selectedIndex].innerText;
    parent.jQuery.dialogReturnValue = team.options[team.selectedIndex].innerText;
    //window.close();
    parent.jQuery.closeModalDialog();


-------------------------------------------------------
<input type=text> use style="width:XXpx" to define width

-------------------------------------------------------
<TEXTAREA>
cols=50    
-->
style="width:XXpx"

-------------------------------------------------------    
<frameset>&<frame>
-->
<iframe>      

-------------------------------------------------------
css not work on thead
<THEAD CLASS=eadj-cell-label-important><%=labelBundle.getString("categories_1")%></THEAD>
-->
<THEAD>
  <TR>
    <TH CLASS=eadj-cell-label-important><%=labelBundle.getString("categories_1")%></TH>
  </TR>
</THEAD>

-------------------------------------------------------
click button will auto submit form
<FORM NAME=dataform METHOD='Post'>
-->
<FORM NAME=dataform METHOD='Post' οnsubmit='return false'>

-------------------------------------------------------
when try to hide/show table row, the content trys to fit in the Space of the first cell (<TR ID=create_list STYLE='display:none'>)
document.all.create_list.style.display = 'block';
-->
document.all.create_list.style.display = 'table-row';

-------------------------------------------------------
rowspan=0 displays all rows into one row
rowspan=<%=a%>
-->
rowspan=<%=a==0?1:a%>

-------------------------------------------------------
document.all.item
-->
document.querySelectorAll("xxx")
for example:
        /*
        for (var i = 1;i < document.all.item.length;i++) {
          if (document.all.item(i).checked) chkcount++;
        }
        */
        var items = document.querySelectorAll("input");
        for (var i = 1;i < items.length;i++) {
          if (items[i].checked) chkcount++;
        }

-------------------------------------------------------
requires to add below lines to html because querySelectorAll is supported from IE9
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=edge">

document.all.item<%=StringHelper.trim(rset.getString(1))%>.children(0)
-->
document.all.item<%=StringHelper.trim(rset.getString(1))%>.childNodes[0] //for ie
document.all.item<%=StringHelper.trim(rset.getString(1))%>.childNodes[1] //for chrome

activeRow.cells(2).children(0)
-->
activeRow.cells[2].children[0]

-------------------------------------------------------
iframe.location = url; //ie
iframe.src = url; //chrome

-------------------------------------------------------
if window.open return null, safari will execute xxx.close() error
var win2 =  window.open('',"subrlist1",'width=10, height=10');
win2.close();
-->
if (win2) {
  win2.close();
}

-------------------------------------------------------

onBlur、focus()与alert()一起用会导致死循环:

Example:
pos_rs_order_top.jsp:
<script>
function afterHandleBy() {
    oForm.iAction.value     = 'afterField';
    oForm.iAfterField.value = 'iHandleBy';
    oForm.action='pos_rs_order_save.jsp';
    oForm.target='FrameJsp';
    oForm.submit();
}
</script>
<input type="text" name="iHandleBy" style="width:140px;" maxlength="25" class="tbox" value="<%=iHandleBy%>" onKeyPress="toUpper();" onBlur="afterHandleBy();" tabindex="1"><!--m1(change size=12->width=140px)-->

pos_rs_order_save.jsp:
alert('<%=msgBundle.getString("hand_by_salesman")%>');
top.FrameTop.form.iHandleBy.focus();

my fix way(Alex):
set timeout function in pos_rs_order_top.jsp and remove focus() in pos_rs_order_save.jsp:

<script>
function afterHandleBy() {
    oForm.iAction.value     = 'afterField';
    oForm.iAfterField.value = 'iHandleBy';
    oForm.action='pos_rs_order_save.jsp';
    oForm.target='FrameJsp';
    oForm.submit();
    setTimeout(function(){
        oForm.iHandleBy.focus();
    },500);
}
</script>

-------------------------------------------------------

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值