// JavaScript Document
Array.prototype.has = function(e){for(var i in this){if(this[i]===e)return true;}return false};
Array.prototype.each = function(fn){for(var i=0,l=this.length;i
Array.prototype.merge=function(arr){
for(var i=0,l=arr.length;i
return this
};
String.prototype.isPhoneNum=function(){if(this == '')return false;var reg =/^(((0[1-2]\d)|(0[3-9]\d{2}))-\d{7,8})?$/;return this.match(reg) ? true : false}
String.prototype.isAllChinese=function(){if(this == '')return false;var reg =/^([^\u0000-\u00FF]+)$/;return this.match(reg) ? true : false}
String.prototype.isAllNumber=function(){if(this == '')return false;var reg =/^(\d+)$/;return this.match(reg) ? true : false}
String.prototype.isWebSite=function(){if(this == '')return false;var reg =/^(www.)(\w)+.[a-zA-Z]{2,3}$/;return this.match(reg) ? true : false}
String.prototype.isEmail=function(){if(this == '')return false;var reg =/^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;return this.match(reg) ? true : false}
String.prototype.isMobil=function(){if(this == '')return false;var reg =/^(13[0-9]|15[0|1|3|6|7|8|9]|18[0|6|7|8|9])\d{8}$/;return this.match(reg) ? true : false}
String.prototype.isPic=function(){if(this == '')return false;var reg =/(.bmp|.jpg|.jpeg|.png|.gif)$/i;return this.match(reg) ? true : false}
String.prototype.isMoney=function(){if(this == '')return false;var reg =/^(\d+)(万)?$/;return this.match(reg) ? true : false}
function G(a){return typeof a==='string'?document.getElementById(a):a};
$.isIE=document.all?true:false;
/*--------------事件处理机制----------------*/
var $Evt=function(){
var t=this;
t.tipBox=[];
t.rule={mouseover:/o[\d]-([^\s]*)/g,click:/e[\d]-([^\s]*)/g,mousedown:/d[\d]-([^\s]*)/g,mouseout:/u[\d]-([^\s]*)/g};
document.onclick = function(e){e=e||window.event;t.finder(e.target||e.srcElement,e,t.rule.click)};
document.onmouseover = function(e){e=e||window.event;t.finder(e.target||e.srcElement,e,t.rule.mouseover)};
document.onmousedown = function(e){e=e||window.event;t.finder(e.target||e.srcElement,e,t.rule.mousedown)};
document.onmouseout = function(e){e=e||window.event;t.finder(e.target||e.srcElement,e,t.rule.mouseout)};
t.EvtBubble={
//(class="ea-class-func")[禁止冒泡]
1:function(){return true},
//(class="eb-class-func")[阻止返回默认值]
2:function(e){$.isIE?e.returnValue=false:e.preventDefault();return false},
//(class="ec-class-func")[禁止冒泡并阻止返回默认值]
3:function(e){$.isIE?e.returnValue=false:e.preventDefault();return true;}
};
};
$Evt.prototype={
finder:function(target,event,rule){
var c,el=target,isStop=false;
while(el.tagName.toLowerCase()!='html'){
if(c=el.className.match(rule)){
for(var i=0,l=c.length;i<1;i++){
var a=c[i].replace(/[eod]([\d])-/,'').split('-');
var sign=RegExp.$1;
var cls=a[0],fn=a[1];
var cname=window[cls];
if(cname==undefined)return;
var func=cname[fn];
if(typeof func==='function'){
cname._event=event;//当前事件event
cname._target=target;//触发事件的标签
cname._self=el;//设置事件的标签
func.apply(cname,a.slice(2));
}else alert('undefined:'+cls+'.'+fn);
if(this.EvtBubble[sign]!=undefined)isStop=this.EvtBubble[sign](event);
}
if(isStop)break;else el=el.parentNode;
}else el=el.parentNode;
}
if(!isStop && event.type=='click')this.clear();
},
clear:function(){for(var i=0,l=this.tipBox.length;i
push:function(el){el=G(el);if(!el)return;if(!this.tipBox.has(el))this.tipBox.push(el)}
};$Evt=new $Evt;
/*--------------End----------------*/
var root = function(){}
root.prototype= {
del: function(){
$(this._target).parent('.pro_con1').remove();
},
radio: function(n){
$("#radioxy > div").each(function(i){
$("#radioxy > div").eq(i).hide()
})
$("#radioxy > div").eq(n).show()
}
}
var root = new root();
网店产品
站外产品
$("#add_pro").click(function(){
var html = '
';$("#pro_con").append(html);
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史