📄 user.js
字号:
//上传操作 End ============================================
function textLimitCheck(thisArea, maxLength){
if (thisArea.value.length > maxLength){
alert('限 '+maxLength + ' 个字符. \r超出的部分将自动去除.');
thisArea.value = thisArea.value.substring(0, maxLength);
thisArea.focus();
}
}
function DBC2SBC(input,str,flag){
var i;
var result='';
for(i=0;i<str.length;i++){
str1=str.charCodeAt(i);
if(str1<125&&!flag)
result+=String.fromCharCode(str.charCodeAt(i));
else
result+=String.fromCharCode(str.charCodeAt(i)-65248);
}
input.value = result;
}
//ajax提示框========================================
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove
function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}
function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}
function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
function openWithIframe(tit,url,w,h){
//屏幕变暗
var sWidth,sHeight;
sWidth=document.body.clientWidth;
sHeight=document.body.scrollHeight;
if(sHeight<window.screen.height){sHeight=window.screen.height;}
var bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#000000";
bgObj.style.filter="Alpha(Opacity=30);";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
//显示层
massage_box.style.left = (document.body.clientWidth - w) / 2;
massage_box.style.top = (screen.height - h) / 2-80;
massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape
massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape
massage_box.style.width = w+"px";
massage_box.style.height = h+"px";
massage_box.className = "massage_box";
var popiframe;
popiframe = '<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; ">'
popiframe += '<div onmousedown=MDown(massage_box) style="background:#666666; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">'
popiframe += '<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title>'+tit+'</div>'
popiframe += '<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px">关闭</span>'
popiframe += '</div>'
popiframe += '<div style="padding:5px" ><iframe src="'+url+'" width="'+(w-11)+'px" height="'+(h-36)+'px" frameborder=0 scrolling=no></iframe></div>'
popiframe += '</div>'
massage_box.innerHTML=popiframe;
massage_box.style.display = "";
}
function closeWithIframe(){
massage_box.style.display="none";
document.body.removeChild(document.getElementById("bgDiv"));
}
document.write('<div id="massage_box" style="display:none">loading...</div>');
//ajax提示框功能========================================
function replaceInput(obj,event){
if(event.keyCode!=37 && event.keyCode!=39){
var IsTitle=/[^\u4E00-\u9FA50-9a-zA-Z\-_! (),.\%\#\$\&\*|:"'?]/g;
if(IsTitle.test(obj.value)){
obj.value=obj.value.replace(IsTitle,'');
}
}
}
var dj1 = 0;
var dj2 = 0;
var dj3 = 0;
var dj4 = 0;
var dj5 = 0;
var dj6 = 0;
var dj7 = 0;
var djct = 0;
var djil = 0;
function ShowChange(id,str,il,ct,uil,uct){
if(str==""){str=0}
if(parseInt(id)>0){
switch (parseInt(id)) {
case 1:
if(dj1==0){djct = djct+ct;djil = djil+il;dj1 = str;}else{djct = djct-ct*dj1;djil = djil-il*dj1;dj1 = 0;}
break;
case 2:
if(dj2==0){djct = djct+ct;djil = djil+il;dj2 = str;}else{djct = djct-ct*dj2;djil = djil-il*dj2;dj2 = 0;}
break;
case 3:
if(dj3<str){
djct = djct+ct*parseInt(str-dj3);
djil = djil+il*parseInt(str-dj3);
dj3 = str;
}else{
djct = djct-ct*parseInt(dj3-str);
djil = djil-il*parseInt(dj3-str);
dj3 = str;
}
break;
case 4:
if(dj4<str){
djct = djct+ct*parseInt(str-dj4);
djil = djil+il*parseInt(str-dj4);
dj4 = str;
}else{
djct = djct-ct*parseInt(dj4-str);
djil = djil-il*parseInt(dj4-str);
dj4 = str;
}
break;
case 5:
if(dj5<str){
djct = djct+ct*parseInt(str-dj5);
djil = djil+il*parseInt(str-dj5);
dj5 = str;
}else{
djct = djct-ct*parseInt(dj5-str);
djil = djil-il*parseInt(dj5-str);
dj5 = str;
}
break;
case 6:
if(dj6<str){
djct = djct+ct*parseInt(str-dj6);
djil = djil+il*parseInt(str-dj6);
dj6 = str;
}else{
djct = djct-ct*parseInt(dj6-str);
djil = djil-il*parseInt(dj6-str);
dj6 = str;
}
break;
case 7:
if(dj7<str){
djct = djct+ct*parseInt(str-dj7);
djil = djil+il*parseInt(str-dj7);
dj7 = str;
}else{
djct = djct-ct*parseInt(dj7-str);
djil = djil-il*parseInt(dj7-str);
dj7 = str;
}
break;
}
if(uct-djct<0 || uil-djil<0){
if(confirm('您的积分或点券已不够本次支付,现在就去兑换?')){parent.location = 'User_Exchange.asp'}
}
Ct.innerText = djct;
Il.innerText = djil;
}else{
//if(djct==0){alert('您还没有购买任何道具');return false;}
if(uct-djct<0 || uil-djil<0){
if(confirm('您的积分或点券已不够本次支付,现在就去兑换?')){parent.location = 'User_Exchange.asp'}else{return false;}
}
myform.submit();
}
}
//添加广告表单
function ads(i){
switch(i){
case "text":
ad1.style.display = "none";
ad2.style.display = "";
ad3.style.display = "";
ad4.style.display = "none";
ad5.style.display = "";
ad6.style.display = "none";
break;
case "pic":
ad1.style.display = "";
ad2.style.display = "none";
ad3.style.display = "";
ad4.style.display = "";
ad5.style.display = "";
ad6.style.display = "none";
break;
case "swf":
ad1.style.display = "";
ad2.style.display = "none";
ad3.style.display = "none";
ad4.style.display = "";
ad5.style.display = "none";
ad6.style.display = "none";
break;
case "code":
ad1.style.display = "none";
ad2.style.display = "none";
ad3.style.display = "none";
ad4.style.display = "none";
ad5.style.display = "none";
ad6.style.display = "";
break;
}
}
//公用ajax
function InitAjax(){
var ajax=false;
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); }
return ajax;}
function ToAjax(url,Post){
if (url!=""){
var getinfo = "";
var ajax = InitAjax();
ajax.open("POST", url, true);
ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
ajax.send(Post);
ajax.onreadystatechange = function(){
if (ajax.readyState == 4){getinfo = ajax.responseText;}
AjaxShow.innerHTML = getinfo;
}
}
}
function ad_pic(){
if (myform.L.value =="" || myform.Pic.value =="" ){
myform.L.focus();
alert('输入不完整');
}else{
if(myform.P.value !=""){
myform.P.value = myform.L.value+'|'+myform.Pic.value+'\n'+myform.P.value;
}else{
myform.P.value = myform.L.value+'|'+myform.Pic.value;
}
myform.L.value = "";
myform.Pic.value = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -