- 浏览: 1721206 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (337)
- javaScript校验 (11)
- java (31)
- java连接数据库 (1)
- js应用 (41)
- JQuery (15)
- linux操作命令 (12)
- loadrunner测试 (5)
- tomcat (18)
- 数据库 (12)
- eclipse (7)
- 触发器 (7)
- 表单 (3)
- ibatis (6)
- oracle (4)
- xml (1)
- Exception (6)
- spring (16)
- struts (4)
- struts 标签 (2)
- sql (8)
- sql server (6)
- 其它 (18)
- Apache (2)
- 电脑故障 (4)
- java 线程 (1)
- dwr (8)
- jackey (18)
- 总结 (34)
- gcc linux (2)
- extjs 学习 (5)
- 网站建设 (4)
- 健康 (2)
- 房地产知识 (1)
- hibernate (3)
- mysql (7)
- linux (13)
- svn (1)
最新评论
-
阳光泛滥的日子:
很好用谢谢
java.net.URISyntaxException的解决办法 -
linjianqing:
现在有更好的处理方式吗?我正也为这发愁
applet访问打印机出现的问题 -
ruyi574812039:
非常感谢您的总结!想问几个问题!假设三个项目分别以静态部署的三 ...
在Tomcat中部署Web程序的几种方式 -
yangguo:
太j8麻烦了
Spring3.1中使用缓存注解及Shiro的缓存联合 -
bellawang:
很好用谢谢
java.net.URISyntaxException的解决办法
1 javascript刷新页面的方法
window.location.reload();
使用window.open()弹出的弹出窗口,刷新父窗口
window.opener.location.reload()
使用window.showDialog弹出的模式窗口
window.dialogArguments.location.reload();
2.javascript弹出窗口的两种实现方式 ---下面给两个弹出屏幕居中窗口的例子
window.open()方式
function ShowDialog(url) {
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(window.screen.height-iHeight)/2;
var iLeft=(window.screen.width-iWidth)/2;
window.open(url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,
Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
}
window.showModalDialog方式
function ShowDialog(url) {
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(window.screen.height-iHeight)/2;
var iLeft=(window.screen.width-iWidth)/2;
window.showModalDialog(url,window,"dialogHeight: "+iHeight+"px; dialogWidth: "+iWidth+"px;
dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no;scroll:no");
}
注意这里的第二个参数,window
3.页面中设置不进行缓存数据的方法
在jsp页面加入如下语句
<%
response.setHeader("Pragma","No-Cache");
response.setHeader("Cache-Control","No-Cache");
response.setDateHeader("Expires", 0);
%>
4.无提示关闭页面的方法
function CloseWin(){
var ua = navigator.userAgent; var ie = navigator.appName=="Microsoft Internet Explorer"?true:false;
if(ie){
var IEversion = parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))));
if( IEversion< 5.5){
var str = '';
document.body.insertAdjacentHTML("beforeEnd", str);
document.all.noTipClose.Click();
} else {
window.opener =null; window.close();
}
}else{
window.close()
}
}
5、定时关闭弹出的窗口---设置/清除定时器
scriptlanguage="JavaScript"
!--
functioncloseit(){
setTimeout("self.close()",100000)//单位是毫秒,这里是100秒
setInterval("self.close()",100000)
window.clearTimeout(me.timer);
window.clearInterval(me.timer);
/script
6.javascript弹出子窗口中传值---通过url传值
<script language="javascript" type="text/javascript">
function fn_modify(pid){
var ModifyInfo=new Object();
window.showModalDialog("modify_main.asp?pid="+pid,ModifyInfo,"dialogHeight:180px;dialogWidth:300px;dialogLeft:;dialogTop:;resizable:off;center:on;help:off;scroll:off;status:off")
Reload();
}
function Reload(){location.href="abc.asp";}
</SCRIPT>
<a href="abc.asp" onClick="fn_modify('这是值')">单击</a>
7.js隐藏/显示表单
document.all("id").style.display=="none";//隐藏
document.all("id").style.display=="";//显示
document.getElementById("bt").style.display=="none"
document.getElementById("bt").style.display==""
id为table,input 的id
8.js控制表单元素有效/失效
document.getElementById("bt").disabled=true;
document.all("Submit1").disabled=true;//失效
document.all("Submit1").disabled=false;//有效
设置/获取元素的值
document.getElementById("labTitle").innerHTML="IP模式";//设置值
document.getElementById("labTitle").innerHTML//获取值
labTitle 为div,span,table的id
实例1:
[code]<input id="mytext" type="text" value="我是不能用的">
<input type="button" value="disabled" onClick="javascript: document.all.mytext.disabled='false'">
<input type="button" value="enable" onClick="javascript: document.all.mytext.removeAttribute('disabled')">[/code]
实例2:
[code] <input id="mytext" type="text" value="我是能用的">
<input type="button" value="disable" onClick="if (mytext.disabled==false){ mytext.disabled=true;mytext.value='我是不能用的';this.value='enable'} else { mytext.disabled=false;mytext.value='我是能用的';this.value='disable'}"> [/code]
9.页面通过函数提交表单的方法
function exit(){
selcardForm.action="/NDHotel/queryTroom.do?method=exitSystem";
selcardForm.submit();
}
10.遍历radio方法
<input id="mode1" type="radio" name="workMode" value="1" checked>
var radios=document.getElementsByName("workMode");
var workMode="";
for(var i=0;i<radios.length;i++){
if(radios[i].checked==true){
workMode=radios[i].value;
}
}
11.向select中动态添加option
<select id="ddlProvince" name="ddlProvince" onchange="cityResult()">
var prov=document.getElementById("ddlProvince");
prov.options.add(new Option("---请选择---",""));
var pArray=zoneIdProvince.split("&");
for(var i=0;i<pArray.length;i++){
var idpArray=pArray[i].split("#");
var sZoneID=idpArray[0];
var sProvince=idpArray[1];
prov.options.add(new Option(sProvince,sZoneID));
}
12.页面中使用prototype ajax提交数据的实现方式(java)
一步:在<head></head>中添加以下js文件链接
<head>
<script language="JavaScript" src="/NDHotel/js/prototype-1.6.js"></script>
</head>
二步:把prototype-1.6.js文件放到/NDHotel/js/指定的目录中
三步:在<script type="text/javascript"></script>中声明以下调用函数
<script type="text/javascript">
function editIpSegment(){
var url='/NDHotel/ipsegmentset.do?method=roomChangeNotice';
var pars = 'startip='+startip+'&endip='+endip+'&lindex='+lindex;
new Ajax.Request( url, {method: 'get', parameters: pars, asynchronous:false,onComplete:editResult});
}
function editResult(result){
var returnStr = result.responseText;
if(returnStr =='fail'){
alert("");
return false;
}
}
</script>
四步:实现后台调用
public ActionForward roomChangeNotice(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String result = "";
PrintWriter pw = RainPrintWriter.getPrintWriter(response);
try {
NotifyServiceTwo.sendMessage(4, 0);
result = "success";
} catch (Exception e) {
logger.error("roomChangeNotice" + e);
}
pw.write(result);
pw.close();
return null;
}
13.js中获取表单的值的方式:
document.getElementById("lindex").value
document.all.lindex.value//lindex在页面中必须是唯一的
//设置获取焦点
document.getElementById("lindex").focus()
document.all.startip.focus()
//设置失去焦点
document.getElementById("lindex").blur()
document.all.startip.blur()
14.动态添加/删除表格中的行
<table width="100%" id="tdSearch" name="tdSearch" cellpadding="0" cellspacing="0" align="center">
</table>
//动态生成table的行
var autoId = 0; // 自增变量
function addRow(value1,value2){
var highQuery=document.getElementById("tdSearch");
highQuery.insertRow();
var newRow = highQuery.rows[highQuery.rows.length - 1];
newRow.id = "row_" + autoId;
newRow.insertCell();
newRow.cells[0].innerHTML = "<input width='200' value='"+value1+"' onchange='changeip("+autoId+")' type='text' id='bIPFrom_"+autoId+"'>-";
newRow.insertCell();
newRow.cells[1].innerHTML = "<input width='200' value='"+value2+"' type='text' id='bIPTo_"+autoId+"'> ";
var cell2 = newRow.insertCell();
cell2.innerHTML = "<input class='btn_1word' type='button' class='HQ_BUTTON' value='-' onClick=removeRow('" + newRow.id + "')>";
cell2.setAttribute("class", "yellowCell2");
autoId=autoId+1;
}
function removeRow(rowId){
var trRow = document.getElementById(rowId);
//alert(trRow);
//if(rowId!="row_0"){
trRow.removeNode(true);
//}
}
15. 集合
//显示导入进度条
document.all("btnImport").disabled=true;
document.all("DataGrid_WaitDiv").style.left=100;
document.all("DataGrid_WaitDiv").style.top=295;
document.all("DataGrid_WaitDiv").style.display = "";
form1.action="/NDHotel/jsp/systemset/roomSet/uploadFile.jsp";
form1.submit();
13.新建一个窗口
function layer1AddGroup() {
var url='/NDHotel/jsp/systemset/roomSet/addGroup.jsp';
var newwin=window.showModalDialog(url,window,"dialogWidth=470px;dialogHeight=400px;scroll=yes;status=no;help=no;");
}
//刷新父页面
function roomMainLeftRightFrame(){
var layer='<%=layer%>';
window.parent.parent.frames('view').location.href="/NDHotel/troom.do?method=roomSetLeftMenu&layer="+layer;
}
14.设置文本框只读属性/设置文本框的颜色/设置radio选中
document.all("txt_AutoTime").readOnly=true;
document.all("txt_AutoTime").style.backgroundColor="#d0d0d0";
runParamSetForm.radNotForcibly.checked=true;
//IP地址验证
function ipCheck(ipValue){
var reg = /^\d{1,3}(\.\d{1,3}){3}$/;
if(ipValue != ""){
if (reg.test(ipValue)){
var ary = ipValue.split('.');
for(key in ary){
if (parseInt(ary[key]) > 255 )
return false;
}
return true;
}else
return false;
}else
return true;
}
发表评论
-
实现Applet与Servlet之间进行通讯的简单实例
2011-08-09 21:36 2950Servlet传送查询记录集给Applet 这篇文章是继< ... -
javascript的子窗口和父窗口的传值与刷新
2010-02-21 18:04 3144另存为子窗口 <!DOCTYPE HTML PUB ... -
showModalDialog参数使用详解
2010-02-04 19:24 1585showModalDialog:模式窗 ... -
Log4j配置文件的示例_jackey
2010-02-03 13:05 1993引子: 最近老是用到log4j的东西,我想这样优秀的一个 ... -
实现数据库中的数据(db data)转化成document文档 实现jdbc批量插入数据
2010-01-28 16:36 1707package com.test; import java. ... -
Ajax实现文件上传 jackey 好方法
2010-01-19 11:02 8257首先要说的就是 ajax 是无法实现上传文件的,可以想一下aj ... -
js控制select的option
2010-01-05 15:15 5715js控制select的option JS sele ... -
Windows下Apache+Tomcat+MySQL+jsp+php的服务器整合配置
2009-09-29 14:30 2484所需软件 (1) j2sdk- ... -
Windows下Apache+Tomcat+MySQL+jsp+php的服务器整合配置
2009-09-29 14:22 3832所需软件(1) j2sdk-1_4_2-win ... -
EL表达式 (详解)
2009-09-12 02:59 8205EL表达式 1、EL简介1)语法结构 ... -
在Tomcat中部署Web程序的几种方式
2009-09-10 18:36 20278在Tomcat中部署Java Web应用程序有两种方式:静态部 ... -
window xp Service pack 2+ iis 5.1+tomcat-5.5.27 +jdk1.5.0_08
2009-08-07 23:34 4223xp下整合IIS和tomcat ... -
使用IIS+Tomcat6.0将JSP网站发布到Internet
2009-08-07 10:40 5750使用IIS+Tomcat6.0将JS ... -
Spring整合第三方MVC框架的通用配置
2009-08-06 17:55 1542Spring整合第三方MVC框架的通用配置 ... -
常见错误解决方案
2009-08-06 14:33 17081. sql server 错误签名 ISQL/w - ... -
dwr spring 如何配置
2009-08-06 13:57 2718DWR和Spring 让DWR和Spring一起工作的步 ... -
java 遍历map 方法 集合 jackey
2009-08-02 12:02 29621package com.jackey.topic; impo ... -
JSON 入门指南 jackey
2009-07-29 16:43 1301JSON 即 JavaScript Object Natati ... -
Eclipse插件的安装有两种方法 ___jackey
2009-07-29 14:06 1290Eclipse插件的安装有两种 ... -
利用apache的proxy-ajp做apache与tomcat的结合(转载) jackey
2009-07-28 16:14 2186解压apache的源代码 # ta ...
相关推荐
jacky代码,随便下载
[企业政府]Jacky法律在线网站源码_falv.zip源码ASP.NET网站源码打包下载[企业政府]Jacky法律在线网站源码_falv.zip源码ASP.NET网站源码打包下载[企业政府]Jacky法律在线网站源码_falv.zip源码ASP.NET网站源码打包...
jacky_dai的博客文章.pdf
Symantec云安全解决方案-jacky zhu.docx
Fetion Tool 最简单的飞信工具 by jacky_luo .rar
ASP.NET源码——Jacky法律在线网站源码.zip
ASP.NET源码——[企业]Jacky法律在线网站源码.zip
.NET环境下水晶报表使用总结 水晶报表是一个优秀的报表开发工具,在开发通用管理系统的时候,所有报表都使用水晶报表,其简单、易用和强大的功能令笔者倍加喜爱,现将水晶报表使用手记呈现给大家,不过不是本人的...
博文链接:https://jacky68147527.iteye.com/blog/230139
shopOfSweets_jacky415 shopOfSweets_jacky415shopOfSweets_jacky415 ---关于糖果店的多彩网站,使用了Bootstrap
Jacky的打飞机游戏 已在Eclipse能运行,含有APK文件 感谢Jacky的教程 和 他的源码,嘿嘿!! 在此附上他的博客地址 ,一起支持他http://blog.csdn.net/jackystudio/article/category/1591201
Jacky说用户体验︱软件UX模型在硬件产品领域的应用.docx
内存颗粒检测 memtest JACKY版 2.1 4.2 rst
「安全管理」AppSecEU2016-Jacky-Fox-Women-in-Cyber - NGFW 安全建设 安全方案 数据库审计 系统安全 NGFW
信息安全_数据安全_AppSecEU2016-Jacky-Fox-Women-in-Cyber 应用审计 用户隐私 业务安全 情报处理 数字风险
导航栏切换 div+css+js 源码 by Jacky
源码参考,欢迎下载
年度总结年度总结年度总结.7z
老师设置视频不能拖动,导致不能直接看想看的部分,降低了效率 问题: – 因为网络的问题,加载的有点慢。...来源:云班课js脚本解除视频不可快进 – Jacky Mao 链接:https://www.xiaokai1999.cn/archives/599
完整FTP上传、下载、列出文件及目录列表源码,并进行了升级,绝对可用; 附带FTP管理类库袋代码,界面清晰,易读,代码有详细注释,参考价值高。