日期:2014-05-16 浏览次数:20391 次
//当页面关闭时触发
window.onbeforeunload = function()
{
alert('关闭了吧');
}
//关闭窗口(弹出式窗口)
parent.window.close();
//关闭窗口
window.close();
//拷贝内容
window.clipboardData.setData("Text",clipBoardContent);
//是否是数字
alert(isNuN('333'));
//提交
function submitUp(){
var formObj = document.getElementById("form");
formObj.action = "${request.contextPath}/mol/newRecordFileInfo.action";
formObj.submit();
}
//返回指定action
function backUp(){
var form1 = document.getElementById("form1");
form1.action = "${request.contextPath}/mol/newRecordFilePage.action";
form1.target = "_self";
form1.submit();
}
//比较两个时间大小
var RELEASETIME = document.getElementById("RELEASETIME").value;
var INVALIDTIME = document.getElementById("INVALIDTIME").value;
alert(formatDate(RELEASETIME) > formatDate(INVALIDTIME));
//JS转义URL字符与反转义
1、
encodeURIComponent("URL")
decodeURIComponent("URL")
2、
encodeURI("URL")
decodeURI("URL")
3、
escape("URL")
unescape("URL")
//处理小数点问题 1.丢弃小数部分,保留整数部分 js:parseInt(9/2) 2.向上取整,有小数就整数部分加1 js: Math.ceil(9/2) 3,四舍五入. js: Math.round(9/2) 4,向下取整 js: Math.floor(9/2)
//js的target target属性指定所链接的页面在浏览器窗口中的打开方式,它的参数值主要有:_blank、_parent、_self、_top,这些参数值代表的含义如下: _blank,在新浏览器窗口中打开链接文件。 _parent,将链接的文件载入含有该链接框架的父框架集或父窗口中。如果含有该链接的框架不是嵌套的,则在浏览器全屏窗口中载入链接的文件,就象_self参数一样。 _self,在同一框架或窗口中打开所链接的文档。此参数为默认值,通常不用指定。 但是我不太理解 _top,在当前的整个浏览器窗口中打开所链接的文档,因而会删除所有框架
//屏蔽退格删除键
document.onkeydown = function keydown()
{
if (event.keyCode==8)
{
event.keyCode=0;
event.returnValue=false;
}
}
/***********************
* 函数:判断滚轮滚动动作
*************************/
var scrollFunc=function(e){
if(event.shiftKey && window.event.shiftKey){
event.returnValue=false;
//alert('go');
}
}
/*注册事件*/
if(document.addEventListener){
document.addEventListener('DOMMouseScroll',scrollFunc,false);
}
window.onmousewheel=document.onmousewheel=scrollFunc;
//屏蔽右键
document.oncontextmenu=function(){return false};
//屏蔽复制、粘贴、剪切和选择
<body oncopy="return false;" onpaste="return false"
oncut="return false;" onselectstart="return false;">
//鼠标弹起触发 onmouseup="dojs()";
//秒数变为分秒
var sec = ${examExcuteLogInfo.timeLong}%60;
var minu =parseInt(${examExcuteLogInfo.timeLong}/60);
var showTime = "";
if(minu > 0){
showTime = minu+"分"+sec;
}else{
showTime = sec;
}
document.getElementById("TIMELONG").innerHTML=showTime;
//页面部分
<span class="text_bb" id="TIMELONG"></span>
EL表达时
//只有页面部分
//如果大于一分钟显示分钟值
<isap:if test="${(timeLong/60) >= 1}">
<fmt:formatNumber type="number" value="${timeLong/60-0.5}" maxFractionDigits="0"/>
<isap:message key="'分'" />
</isap:if>
${timeLong%60}