一、元素type属性和= == ===区别、功能--点击【通过】按钮-showModalDialog弹出新页面

/*标签对象的type属性取值:

button  定义可点击按钮
checkbox 定义复选框。
file  定义输入字段和 "浏览"按钮,供文件上传。
hidden  定义隐藏的输入字段。
image  定义图像形式的提交按钮。
password 定义密码字段。该字段中的字符被掩码。
radio  定义单选按钮。
reset  定义重置按钮。重置按钮会清除表单中的所有数据。
submit  定义提交按钮。提交按钮会把表单数据发送到服务器。
text  定义单行的输入字段,用户可在其中输入文本。默认宽度为 20 个字符

*/

/*常用函数、运算符  typeof 在程序运行阶段动态判断变量的数据类型
1)typeof运算结果是字符串类型,结果可能是以下六种结果之一:"undefined"  "number" "string"
"objcet" "boolean" "function"
2)isNaN()--》该函数:用来判断数据是否是一个数字,不是数字是true,是数字是false
3)parseInt()--》该函数:将非数字转换成数字,保留小数位
4)parseFloat()--》该函数:可以将非数组转化为数字但是保留小数
5)js中:
  =  赋值:
  == 比较值是否相当
  === 比较值是否相同,同时要求数据类型也相同(更加严格)
  underfined,null,NaN各自的数据类型不同:
  alert(typeof underfined);//"underfined"
  alert(typeof null);//"object"
  alert(typeof NaN);//"number"
  underfined 和null属于:值相等
  alert(underfined==null);//true
  alert(null==NaN);//false
  alert(underfined==NaN);//false
 */

 1、功能--点击【通过】按钮弹出新页面,且该页面不关闭则无法对父页面进行修改

<p align="left">分公司待审核列表</p>
   <form name="dataAuditListFrom" method="post" action="">

  <input  type="button" value="通过" onclick="bmUpdateAudit('kyDataAuditAction.do?action=updateReportAuditById','radio')">

 </form>

function bmUpdateAudit(dispacher, control) {//control的值为radio
   var count = 0;
   var frm = document.dataAuditListFrom;
   var tmp;
   for (i = 0; i < frm.elements.length; i = i + 1) {
      var e = frm.elements[i];
      if (e.type === control && e.checked === true) {//e.type值为radio,type属性值规定了元素的类型
         count = count + 1;
         tmp = e.value;
      }
   }
   if (count > 0) {
      if (confirm("上报至总公司?")) {
    } else {
       return false;
    }
    var temp = window.showModalDialog(
        dispacher + "&insurCode=" + tmp,
        window,
        'dialogHeight=750px;dialogWidth=1000px;dialogRight=40px;dialogTop=30px;center:yes');
    if (temp == 'fen') {
       seachPage('');
    } else {
    if (temp != undefined)
        seachHeadPage('');
    }

   } else {
    alert("请选择一条记录!");
   }
}

public ModelAndView updateReportAuditById(HttpServletRequest request, HttpServletResponse response, Object obj) throws DaoException {
    String insurCode = request.getParameter("insurCode");
    KyExchBean kyExchBean = (KyExchBean) kyDataAuditService.findKyExchBeanByInsurCode(insurCode);

    List ActionDescList=kyDataAuditService.getActionDescInfoList(insurCode);
    Map map=new HashMap();
    map.put("actionDescList", ActionDescList);
    map.put("insure", kyExchBean);
    return new ModelAndView(this.getKyDataAudit(), map);
 }

  /*获取行为描述信息:
  * */
 public List getActionDescInfoList(String kyReportid)  throws DaoException {
    return kyDataAuditDao.getActionDescList(kyReportid);
 }

 /*获取行为描述信息:
  * */
 public List getActionDescList(String kyReportid) throws DaoException {
    List actionDescList= super.getList("getActionDescList",kyReportid);
    return actionDescList;
 }

 <select id="getActionDescList"  resultMap="actionDescReportBean" parameterClass="string">
     select ky_report_id,exch_feature_code,crime_type_code,other_desc from ky_report where ky_report_id=#kyReportId#
 </select>

知识点:

1)e.type===control说明元素属性值有control值?

不是,是因为该<input>标签的type属性是radio,而control的值也是radio;

2)window.open()和window.showModalDialog()的相同点与区别:
相同点:都是在IE上打开新窗口,
区别点:
window.open()是非阻塞式,也可以说非模态窗口。
window.showModalDialog() 是阻塞式模态窗口。阻塞或者模态窗口,只有你把当前窗口关闭后,才能去操作父亲窗口。且其参数不用放在url里面提高了安全性
具体用法:
window.open( [sURL] [, sName] [, sFeatures] [, bReplace])  打开新窗口并装入给定 URL 的文档。
返回值:返回打开的新窗口对象
sURL:可选参数,要打开新窗口的地址url.
sName:可选参数,新窗口的句柄名,常用的四种有:_blank,_parent,_top,_self.
sFeatures:可选参数,IE窗口相关的特性,有height,width,left.top,location,menubar,resizable,scrollbars,status, titlebar,toolbar,还有channelmode,directories和fullscreen(全屏模态)特殊参数.
sReplace:可选参数
example:window.open("Sample.htm",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");

     window.showModalDialog()  创建一个显示指定 HTML 文档的模式对话框
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
sURL:可选参数,要打开新窗口的地址url.
vArguments:可选参数,可用来向子窗口传递参数.用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。 这个参数隐藏掉,不用放在url里,提高了安全性。
sFeatures:可选参数,dialogHeight,dialogWidth,dailogLeft,dialogTop,center,dialogHide,edge,

3)java中string中substring(int beginIndex)的用法:
示列:
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns " (an empty string)"

 

posted @ 2017-09-18 20:39  爱笑的berg  阅读(323)  评论(0)    收藏  举报