This commit is contained in:
FJY
2017-10-29 22:55:28 +08:00
parent bc345795db
commit 56ae828c97
186 changed files with 7949 additions and 360 deletions

51
WebRoot/js/AjaxRequest.js Normal file
View File

@@ -0,0 +1,51 @@
var net=new Object();
net.AjaxRequest=function(url,onload,onerror,method,params){
this.req=null;
this.onload=onload;
this.onerror=(onerror) ? onerror : this.defaultError;
this.loadDate(url,method,params);
}
net.AjaxRequest.prototype.loadDate=function(url,method,params){
if (!method){
method="GET";
}
if (window.XMLHttpRequest){
this.req=new XMLHttpRequest();
} else if (window.ActiveXObject){
this.req=new ActiveXObject("Microsoft.XMLHTTP");
}
if (this.req){
try{
var loader=this;
this.req.onreadystatechange=function(){
net.AjaxRequest.onReadyState.call(loader);
}
this.req.open(method,url,true);
//this.req.send(params);
this.req.send(null);
}catch (err){
this.onerror.call(this);
}
}
}
net.AjaxRequest.onReadyState=function(){
var req=this.req;
var ready=req.readyState;
if (ready==4){
if (req.status==200 ){
this.onload.call(this);
}else{
this.onerror.call(this);
}
}
}
net.AjaxRequest.prototype.defaultError=function(){
alert("error fetching data!"
+"\n\nreadyState:"+this.req.readyState
+"\nstatus: "+this.req.status
+"\nheaders: "+this.req.getAllResponseHeaders());
}

View File

@@ -0,0 +1,55 @@
$(document).ready(function() {
$('#horizontalTab').easyResponsiveTabs({
type : 'default', //Types: default, vertical, accordion
width : 'auto', //auto or any width like 600px
fit : true, // 100% fit in a container
});
});
function checkpwd() {
'use strict';
var p1 = document.getElementById("Password2").value; //获取密码框的值
var p2 = document.getElementById("Password3").value; //获取重新输入的密码值
if(p1==""){
document.getElementById("msg").innerHTML = "请输入密码!"; //检测到密码为空,提醒输入//
document.register.Password2.focus();//焦点放到密码框
return false;//退出检测函数
}//如果允许空密码,可取消这个条件
if (p1 != p2) { //判断两次输入的值是否一致,不一致则显示错误信息
document.getElementById("msg").innerHTML = "两次输入密码不一致,请重新输入"; //在div显示错误信息
return false;
} else {
document.getElementById("msg").innerHTML = "";
//密码一致,可以继续下一步操作
}
}
var code;
function createCode() {
code = "";
var codeLength = 6; //验证码的长度
var checkCode = document.getElementById("checkCode");
var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); //所有候选组成验证码的字符,当然也可以用中文的
for (var i = 0; i < codeLength; i++) {
var charNum = Math.floor(Math.random() * 52);
code += codeChars[charNum];
}
if (checkCode) {
checkCode.className = "code";
checkCode.innerHTML = code;
}
}
function validateCode() {
var inputCode = document.getElementById("inputCode").value;
if (inputCode.length <= 0) {
document.getElementById("msg").innerHTML = "请输入验证码!";
} else if (inputCode.toUpperCase() != code.toUpperCase()) {
document.getElementById("msg").innerHTML = "验证码输入有误!";
createCode();
} else {
alert("验证码正确!");
}
}

2
WebRoot/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

106
WebRoot/js/jquery.qqFace.js Normal file
View File

@@ -0,0 +1,106 @@
// QQ表情插件
(function($){
$.fn.qqFace = function(options){
var defaults = {
id : 'facebox',
path : 'face/',
assign : 'content',
tip : 'emoji'
};
var option = $.extend(defaults, options);
var assign = $('#'+option.assign);
var id = option.id;
var path = option.path;
var tip = option.tip;
if(assign.length<=0){
alert('缺少表情赋值对象。');
return false;
}
$(this).click(function(e){
var strFace, labFace;
if($('#'+id).length<=0){
strFace = '<div id="'+id+'" style="position:absolute;display:none;z-index:1000;" class="qqFace">' +
'<table border="0" cellspacing="0" cellpadding="0"><tr>';
for(var i=1; i<=75; i++){
labFace ="<image src=arclist/"+i+".gif>";
strFace += '<td><img src="'+path+i+'.gif" onclick="$(\'#'+option.assign+'\').setCaret();$(\'#'+option.assign+'\').insertAtCaret(\'' + labFace + '\');" /></td>';
if( i % 15 == 0 ) strFace += '</tr><tr>';
}
strFace += '</tr></table></div>';
}
$(this).parent().append(strFace);
var offset = $(this).position();
var top = offset.top + $(this).outerHeight();
$('#'+id).css('top',top);
$('#'+id).css('left',offset.left);
$('#'+id).show();
e.stopPropagation();
});
$(document).click(function(){
$('#'+id).hide();
$('#'+id).remove();
});
};
})(jQuery);
jQuery.extend({
unselectContents: function(){
if(window.getSelection)
window.getSelection().removeAllRanges();
else if(document.selection)
document.selection.empty();
}
});
jQuery.fn.extend({
selectContents: function(){
$(this).each(function(i){
var node = this;
var selection, range, doc, win;
if ((doc = node.ownerDocument) && (win = doc.defaultView) && typeof win.getSelection != 'undefined' && typeof doc.createRange != 'undefined' && (selection = window.getSelection()) && typeof selection.removeAllRanges != 'undefined'){
range = doc.createRange();
range.selectNode(node);
if(i == 0){
selection.removeAllRanges();
}
selection.addRange(range);
} else if (document.body && typeof document.body.createTextRange != 'undefined' && (range = document.body.createTextRange())){
range.moveToElementText(node);
range.select();
}
});
},
setCaret: function(){
if(!$.browser.msie) return;
var initSetCaret = function(){
var textObj = $(this).get(0);
textObj.caretPos = document.selection.createRange().duplicate();
};
$(this).click(initSetCaret).select(initSetCaret).keyup(initSetCaret);
},
insertAtCaret: function(textFeildValue){
var textObj = $(this).get(0);
if(document.all && textObj.createTextRange && textObj.caretPos){
var caretPos=textObj.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length-1) == '' ?
textFeildValue+'' : textFeildValue;
} else if(textObj.setSelectionRange){
var rangeStart=textObj.selectionStart;
var rangeEnd=textObj.selectionEnd;
var tempStr1=textObj.value.substring(0,rangeStart);
var tempStr2=textObj.value.substring(rangeEnd);
textObj.value=tempStr1+textFeildValue+tempStr2;
textObj.focus();
var len=textFeildValue.length;
textObj.setSelectionRange(rangeStart+len,rangeStart+len);
textObj.blur();
}else{
textObj.value+=textFeildValue;
}
}
});