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>
-------------------------------------------------------