Form.getInputs
来源:互联网 发布:js模块化概念 编辑:程序博客网 时间:2024/06/05 22:37
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"><!--<link rel="stylesheet" type="text/css" href="styles.css"><[重点理解模式窗口的概念]>window.returnValue的用法:return value 是javascript中html 的windows 对象的属性,目的是返回窗口值,当用window.showModalDialog 函数打开一个IE的模式窗口,模式窗口: 打开后不能操作父窗口,只能等模式窗口关闭时候才能操作,用于返回窗口的值<存在的最大价值>:一个典型的应用场景是: 在父窗口打开一个小窗口, 小窗口用ztree 树形jsp页面,然后点击树的一个节点, 得到节点的key和value, 父窗口得到key 和value 进行后台操作window.showModalDialog() 已废弃.请使用 window.open() 代替.更多信息见 https://developer.mozilla.org/en-US/docs/Web/API/Window.open好的学习资料:reference:<[https://developer.mozilla.org/en-US/docs/Web/API/Window/open]>reference:<[http://www.open-open.com/lib/list/145]>reference:<[http://www.open-open.com/lib/view/open1425865257935.html]>避免在if和while语句的条件部分进行赋值.如if (a = b).应该写成if (a == b).但是在比较是否相等的情况下.最好使用全等运行符.也就是使用===和!==操作符会相对于==和!=会好点.==和!=操作符会进行类型强制转换 --><script type="text/javascript">function showmodal(){ var dialogSettings= "dialogWidth:350px;dialogHeight:350px;help:no;status:no" ; var ret = window.showModalDialog("check_box.jsp", true, dialogSettings); // 获取模式窗口的值,模式窗口的值通过window.returnValue 设置; if (ret) { alert(ret.key + ":" + ret.value); }}</script> </head> <body> <input id="button" type="button" value="打開子窗口" onclick="javascript:showmodal();"> </body></html><%@ page language="java" import="java.util.*" pageEncoding="gbk"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><script type="text/javascript" src="js/prototype.js"></script> </head> <body><form action="" method="get" id="fruitForm"> choose: <br/><br/> <label><input id="Fruit" name="Fruit" type="checkbox" value="apple" />apple </label> <label><input id="Fruit" name="Fruit" type="checkbox" value="peach" />peach </label><label><input id="Fruit" name="Fruit" type="checkbox" value="banana" />banana </label> <label><input id="Fruit" name="Fruit" type="checkbox" value="pear" />pear</label> <input type="button" onclick="pickFruit();" value="Form_getInputs" name="pick"></form> </body><script type="text/javascript">function pickFruit(){ var exportColumnInfo = ""; var serialNos = Form.getInputs("fruitForm","checkbox","Fruit"); serialNos.each(function(serialNo){ if (serialNo.checked) { exportColumnInfo = exportColumnInfo + "," + serialNo.value; } }); // 去掉字符串最前面的逗號 if (exportColumnInfo.length != 0) { exportColumnInfo = exportColumnInfo.substring(1); } // 產生一個對象 var anObj = new Object(); anObj.key = "所选参数值为 "; anObj.value = exportColumnInfo; window.returnValue = anObj; window.close();}</script>
// prototype.js download and usage, gitHub:http://prototypejs.org/download/// prototype.js API:http://prototypejs.org/doc/1.7_rc2/dom/Element/// <script type="text/javascript" src="/path/to/prototype.js"></script><script type="text/javascript" src="js/prototype.js"></script><script type="text/javascript">function pickFruit(){ var serialNos = Form.getInputs("fruitForm","checkbox","Fruit"); serialNos.each(function(serialNo){ if (serialNo.checked){alert(serialNo.value);} }); }</script></head> <body> <form action="" method="get" id="fruitForm"> 您喜欢的水果? <br /><br /> <label><input id="Fruit" name="Fruit" type="checkbox" value="apple" />苹果 </label> <label><input id="Fruit" name="Fruit" type="checkbox" value="peach" />桃子 </label><label><input id="Fruit" name="Fruit" type="checkbox" value="banana" />香蕉 </label> <label><input id="Fruit" name="Fruit" type="checkbox" value="pear" />梨 </label> <input type="button" onclick="pickFruit();" value="Form_getInputs" name="pick"></form> </body>// JavaScript 原型使用小例子:String.prototype.dynamic = function(){ var matchs = this.match(/\{\d\}/g); var i18nMessage = this; for(var i = 0; i < matchs.length; i++) { var str = matchs[i]; if (defined(str)) i18nMessage = i18nMessage.replace(str, arguments[i]) } return i18nMessage;}// 创建一个 JavaScript 对象:var commonScript = new Object();// 为对象添加方法,方法结尾以分号结束 [方法定义写法: var func = function(){...}]commonScript.openWindow = function(url,width,height,sFeatures){ var availWidth = parseInt(top.screen.availWidth); var availHeight = parseInt(top.screen.availHeight); var left = (availWidth - width)/2; var topw = (availHeight - height)/2; var strFeatures = sFeatures; if (strFeatures == "") { strFeatures = "scrollbars=yes,toolbar=no,menubar=no,location=no,status=yes,resizable=yes,"; } strFeatures += "left=" + left + ",top=" + topw + ",width=" + width + ",height=" + height; var oNewWindow = window.open(url,null,strFeatures); return oNewWindow;};// 方法的引用:<script type="text/javascript" src="${request.contextPath}/js/common.js" />function phaseSuggest(){ window.parent.document.all("worksheetFrameset").rows = "50%,50%"; document.all("suggestTable" + workItemId).style.display = "none"; openWindow = commonScript.openWindow('',400,300,''); openWindow.document.write(res.responseText);}function openWindowDialog(action,param,options){ var wx=options.width; var wy=options.height; var x = top.screen.availWidth; var y = top.screen.availHeight; var wtop =(y-wy)/2; var wleft =(x-wx)/2; var spec = "scrollbars=no,toolbar=no,menubar=no,location=no,status=yes,resizable=yes, left="+wleft+",top="+wtop+",width = " + wx + ",height=" + wy ; var oNewWindow = window.open(action + "?" + param,"_blank",spec); return oNewWindow;}
0 0
- Form.getInputs
- Form
- form
- form
- Form
- form
- FORM
- form
- form
- form
- form
- form
- form
- form
- form
- form
- form
- Form
- Divide Two Integers
- min sum
- [LeetCode][172][Factorial Trailing Zeroes]
- 黑马程序员——Java学习之“浮”谈设计模式
- javaWeb项目下获取当前类的绝对路径
- Form.getInputs
- Js中parseFloat()方法所产的精度不一致问题
- 柴静穹顶之下 感想
- spring rmi 多 ip情况下出现的问题
- linux i2c架构简析
- Linux设备驱动(2)——编译加载
- iOS 自动化集成和测试
- Caused by:org.hibernate.MappingNotFoundException:resouce:com/you/model/Monkey.hbm.xml not found
- Android自学笔记(4)