JS——笔记

1、提交url打开新窗口,并设置窗口参数

    function _openCodeListWin(){
        var height = window.screen.height;
        var width = parseInt(window.screen.width / 2);
        var url = "<%=Env.URL_PREFIX%>/clm/showDoctorCode.do";
        var nw = window.open(url,"_new","scrollbars=yes,resizable=yes,left="+width+",top=0,width="+width+",height="+height);
    }

2、form提交,forms[0]提交的是第一个form表单,FormName是表单name属性

        var form = document.forms[0];
        var url="<%=Env.URL_PREFIX%>/clm/showDoctorCode.do";
        form.action=url;
        form.submit();
	var oForm = document.FormName;	
	oForm.submit();

3、input赋值

$("#doctor_desc").val("");

4、获取table指定列和行的值

table.rows[i].cells[i].innerHTML

5、table行数列数

document.getElementById("myTable").rows.length
document.getElementById("myTable").rows[0].cells.length

6、打开新窗口,并设置样式和title

var url = "<%=Env.URL_PREFIX%>/clm/showDoctorCode.do?type=search";
var nw = window.open(url,"_new","scrollbars=yes,resizable=yes,left=200,top=50,width=700,height=600");
setTimeout(function(){ nw.document.title = 'searchCode'; }, 500);

猜你喜欢

转载自blog.csdn.net/Milan__Kundera/article/details/85766199