?? common.js
字號:
///////AutoScroll Functions
var currentpos, timer;
function initialize(){ //initialize the timer
if(event.srcElement.tagName=='INPUT' || event.srcElement.tagName=='TEXTAREA' || window.name!='main')return false;
timer = setInterval("scrollwindow()", 1);
}
function sc(){
clearInterval(timer);
}
function scrollwindow(){ //auto scroll the window
}
function enabledmouse()
{
self.event.returnValue=true
}
function hiderightmouse()//filter ContextMenu
{
event.returnValue=false
}
function disableselect()//filter SelectAction
{
if(event.srcElement.tagName!='INPUT' && event.srcElement.tagName!='TEXTAREA' ) event.returnValue=false
}
document.onmousedown = sc;
document.ondblclick = initialize;
window.onresize=MM_changeProp;
window.onscroll=MM_changeProp;
window.onerror = killErrors;
//////////////////////////////////////
function killErrors()
{
return true;
}
function checkkey()//filter un-number input
{ //var c=event.keyCode
//if((c>=0x30) && (c<=0x39) || (c==8) || (c==46) || (c==37) || (c==39) || (c==189) || (c==190) )
event.returnValue=true;
//else
// event.returnValue=false;
};
function gonext(obj)//check enter and focus next object
{
if(event.keyCode==13) document.all(obj).focus();
};
function disable(obj,flag)//hide or show an object
{
if(flag)
{
obj.style.visibility='';
}
else
{
obj.style.visibility='hidden';
}
};
function readonly(obj,flag)//set Readonly or un-Readonly to an object
{ if(flag)
{
obj.readOnly=false;
}
else
{
obj.readOnly=true;
}
};
function disabled(obj,flag)//Disabled or Enabled An Object
{ if(flag)
{
obj.disabled=false;
}
else
{
obj.disabled=true;
}
};
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0,Form Checked,modify from Dreamweaver4.0
var i,p,q,nm,test,num,min,max,objfocus='',errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3)
{ test=args[i+2]; val=MM_findObj(args[i]);
if (val) {nm="□ 〖"+val.id+"〗"; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+=nm+' 必須是有效的E-mail地址.\n';
} else if (test!='R') {
if (isNaN(val)) errors+=nm+' 必須是數(shù)字.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=parseInt(test.substring(8,p)); max=parseInt(test.substring(p+1));
if (val<parseInt(min) || max<parseInt(val)) errors+=nm+' 必須是從 '+min+' 到 '+max+' 之間的數(shù)字.\n';
} } } else if (test.charAt(0) == 'R') errors +=nm+' 是必須填寫的項目.\n'; }
/////////////////////////2002年8月7日更新,加入聚焦功能
if(objfocus=='' && errors)
{ objfocus=args[i];
if(document.all(objfocus).type=='hidden')objfocus='Composition';
}
//////////////////
}
if (errors) {
alert( '在您的表格中發(fā)現(xiàn)以下問題:\n----------------------------------------------------------------------\n'+errors);
//alert(objfocus);
document.all[objfocus].focus();
if( objfocus=="Composition") Composition.focus();
}
document.MM_returnValue = (errors == '');
return (errors == '');
}
/////////////Filter HTML Code
function rphtml() {
var args=rphtml.arguments;
for (i=0; i<(args.length); i++)
{ val=MM_findObj(args[i]);
var re=/</g
val.value=val.value.toString().replace(re,'<')
re=/>/g
val.value=val.value.toString().replace(re,'>');
}
}
/////////Opreate Event onMouseOver
function ov(a)
{
a.bgColor=hotcolor;
}
/////////Opreate Event onMouseOut
function mo(a)
{
a.bgColor=vcolcolor;
}
/////////Print the document
function doprint(){
//WebBrowser1.ExecWB(6,1);
window.print();
}
/////////Relocate the background-image
function MM_changeProp()
{
//if(document.body.scrollLeft>0 ) document.all.bg.style.left=document.body.clientWidth-390+document.body.scrollLeft
//if(document.body.scrollTop>0 ) document.all.bg.style.top=document.body.clientHeight-315+document.body.scrollTop
}
function setvalue(ifrom,ito)
{
document.all(ito).value=document.all(ifrom).value
}
function IEVer()
{
var str=navigator.appVersion
var loca=str.indexOf('MSIE') +5
return parseInt(str.substr(loca))
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -