首先申明,本文仅供自己备份
//引用js
<script type="text/javascript" src="/script/jquery.js"></script>
<script type="text/javascript" src="/script/jquery.easydrag.js"></script>
<script type="text/javascript" src="/script/dialog/dialog.js"></script>
<script type="text/javascript" src="/script/public.js"></script>
<script type="text/javascript" src="/script/validate.js"></script>
<script type="text/javascript" src="/dwr/interface/AjaxFacade.js"></script>
<script type="text/javascript" src="/dwr/engine.js"></script>
//colorTable
$(document).ready(function(){
colorTable("dataTable");
});
//load的时候获取焦点
window.onload = function(){
$("#userName").focus();
}
//回车提交信息
$(document).bind("keydown", function(event){
if(event.keyCode == 13){
$("#btn").click();
}
});
//回车提交信息
function document.onkeydown() {
var e=event.srcElement;
if(event.keyCode==13)
{
document.getElementById("btnOK").click();
return false;
}
}
//仿框架用法,但是因为我们要用框架,所以为了避免冲突,不用框架的地方,还是写document.getElementById这种
function $(ele) {
if (typeof(ele) == 'string'){
ele = document.getElementById(ele)
if(!ele){
return null;
}
}
return ele;
}
//取窗口滚动条高度
function getScrollTop()
{
var scrollTop=0;
if(document.documentElement&&document.documentElement.scrollTop)
{
scrollTop=document.documentElement.scrollTop;
}
else if(document.body)
{
scrollTop=document.body.scrollTop;
}
return scrollTop;
}
//防止重复点击链接提交信息
function confirms(ele){
if(!confirm('确认操作?')){
return false;
}else{
ele.outerHTML = "请稍后...";
return true;
}
}
/**
* 在表单提交前,禁用btn,防止重复提交
* @param {Object} id
* @param {Object} value
*/
function disBtn(id,value){
$("#"+id+"").hide();
var buttonValue = value || "操作中...";
$("#"+id+"").after('<input style="width:57px; height:20px;" type="button" value="'+ buttonValue +'" disabled="disabled"');
}
//禁用右键,兼容ie和firefox
document.oncontextmenu = function(e) {
if ( e && e.button == 2 && e.preventDefault )
e.preventDefault();
else
window.event.returnValue = false;
}
//禁用网页另存为
<noscript><iframe src=*.html></iframe></noscript>