⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ig_webdropdown.js

📁 研究怎样通过手写代码来完成自动生成代码
💻 JS
📖 第 1 页 / 共 3 页
字号:
	}
	this.doMouseout=function()
	{
		if(!this.Loaded || this.isReadOnly())return;
		if(this.Dropped)this.swapImage(1);
		this.DropButton.Image.className=this.DropButton.DefaultStyleClassName;
	}
	this.doEvt=function(evt,type,src)
	{
		if(type=="resize")this.inputBox.style.width="100%";
		else if(this.isEnabled())switch(type)
		{
			case "mousedown": this.doMousedown(evt,src);return;
			case "mouseup": this.doMouseup();return;
			case "mouseout": this.doMouseout();return;
			case "mouseover": this.doMouseover();return;
		}
	}
}
function ig_EventListener(fref,oCallBackObject){this.handler=fref;this.callBackObject=oCallBackObject;}
// event initialization for menu object
function igdrp_expandEffects(element,props,oDateChooser)
{
	this._expandEffectSupported	= !((navigator.userAgent.toLowerCase().indexOf("win98")!=-1) || (navigator.userAgent.toLowerCase().indexOf("windows 98")!=-1));
	this.updatePostField=function(){oDateChooser.updatePostField();}
	this.stateNode=ig_ClientState.addNode(oDateChooser.stateNode,"ExpandEffects");
	this.Element=element;
	this.duration=props[0];
	this.opacity=props[1];
	this.type=props[2];
	this.shadowColor=props[3];
	this.shadowWidth=props[4];
	this.delay=props[5];
	this.getDuration=function(){return this.duration;}
	this.getOpacity=function(){return this.opacity;}
	this.getType=function(){return this.type;}
	this.getShadowColor=function(){return this.shadowColor;}
	this.getShadowWidth=function(){return this.shadowWidth;}
	this.getDelay=function(){return this.delay;}
	this.setDuration=function(value){this.duration=value;ig_ClientState.setPropertyValue(this.stateNode,"Duration",value);this.updatePostField();}
	this.setOpacity=function(value){this.opacity=value;ig_ClientState.setPropertyValue(this.stateNode,"Opacity",value);this.updatePostField();}
	this.setType=function(value){this.type=value;ig_ClientState.setPropertyValue(this.stateNode,"Type",value);this.updatePostField();}
	this.setShadowColor=function(value){this.shadowColor=value;ig_ClientState.setPropertyValue(this.stateNode,"ShadowColor",value);this.updatePostField();}
	this.setShadowWidth=function(value){this.shadowWidth=value;ig_ClientState.setPropertyValue(this.stateNode,"ShadowWidth",value);this.updatePostField();}
	this.setDelay=function(value){this.delay=value;ig_ClientState.setPropertyValue(this.stateNode,"Delay",value);this.updatePostField();}
	this.applyFilter=function()
	{
		if(!ig_csom.IsIEWin || !this._expandEffectSupported)return;
		if(this.Type!='NotSet' && this.Element!=null)
			this.Element.style.filter="progid:DXImageTransform.Microsoft."+this.type+"(duration="+(this.duration/1000)+");"
		if(this.shadowWidth>0)
		{
			var s=" progid:DXImageTransform.Microsoft.Shadow(Direction=135, Strength="+this.shadowWidth+",color='"+this.shadowColor+"')";
			this.Element.style.filter+=s;
		}
		if(this.opacity<100)
			this.Element.style.filter+=" progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.opacity+");"
		try{if(this.Element.filters[0]!=null)this.Element.filters[0].apply();}catch(ex){}
		this.Element.style.visibility='visible';
		this.Element.style.display="";
		try{if(this.Element.filters[0]!=null)this.Element.filters[0].play();}catch(ex){}
	}
}
// event initialization for combo object
function igdrp_events(events)
{
	this.eventArray=events;
	this.InitializeCombo=events[0];
	this.BeforeDropDown=events[1];
	this.AfterDropDown=events[2];
	this.BeforeCloseUp=events[3];
	this.AfterCloseUp=events[4];
	this.EditKeyDown=events[5];
	this.EditKeyUp=events[6];
	this.ValueChanged=events[7];
	this.TextChanged=events[8];
	this.OnBlur=events[9];
	this.InvalidDateEntered=events[10];
}
// global mouse down event
function igdrp_mouseDown(evnt)
{
	if(!evnt)evnt=window.event;
	if(!evnt || igdrp_all._droped==null)return;
	var container=igdrp_all._droped.ClientUniqueId+"_container";
	var elem=evnt.srcElement;
	if(elem==null)if((elem=evnt.target)==null)elem=this;
	while(elem!=null)
	{
		if(elem.id==container)return;
		elem=elem.parentNode;
	}
	igdrp_all._droped.setDropDownVisible(false);
}
function igdc_dateChooser(_dcElement,dcProps,calID)
{
	var me=new igdrp_combo(_dcElement,dcProps);
	var info=new ig_DateFormatInfo(eval("igdrp_"+me.Id+"_DateFormatInfo"));
	var dateParts=dcProps[11];
	var date=ig_csom.isEmpty(dateParts)?null:new Date(dateParts[0],dateParts[1]-1,dateParts[2]);
	var editor=new igmask_date(me.inputBox,info,date,dcProps[15]!=0,dcProps[14],dcProps[16]);
	if(!ig_csom.isEmpty(dateParts=dcProps[12]))editor.setMinValue(new Date(dateParts[0],dateParts[1]-1,dateParts[2]));
	if(!ig_csom.isEmpty(dateParts=dcProps[13]))editor.setMaxValue(new Date(dateParts[0],dateParts[1]-1,dateParts[2]));
	editor.parent=me;
	var tab=dcProps[17];
	if(tab&&tab>-1)editor.elem.tabIndex=me.DropButton.Image.tabIndex=tab;
	editor.addEventHandler('keyDown',me.onKeyDown);
	editor.addEventHandler('keyup',me.onKeyUp);
	editor.addEventHandler('blur',me.onBlur);
	if(document.all!=null)ig_csom.addEventListener(me.Element,"resize",igdrp_evt);
	ig_csom.addEventListener(me.DropButton.Image,'keypress',me.onImgKeyDown);
	me.getAllowNull=function(){return this.editor.allowNull;}
	me.setAllowNull=function(bAllowNull){this.editor.allowNull=bAllowNull;}
	me.onInvalidValue=function(o,val,oEvent,oEventArgs){if((o=o.parent)!=null)ig_fireEvent(o,o.Events.InvalidDateEntered[0],oEventArgs,oEvent);}
	editor.addEventHandler("invalidvalue",me.onInvalidValue);
	me.onTextChange=function(o,val,oEvent){if((o=o.parent)!=null)ig_fireEvent(o,o.Events.TextChanged[0],val,oEvent);}
	editor.addEventHandler("x",me.onTextChange);
	me.editor=editor;
	me.setMaxDate=function(date)
	{
		this.editor.setMaxValue(date);
		if(this.Calendar)this.Calendar.MaxDate=date;
		var text=(date!=null)?date.getFullYear()+','+(date.getMonth()+1)+','+date.getDate():'null';
		ig_ClientState.setPropertyValue(this.stateNode,"MaxDate",text);
		this.updatePostField();
	}
	me.getMaxDate=function(){return this.editor.getMaxValue();}
	me.setMinDate=function(date)
	{
		this.editor.setMinValue(date);
		if(this.Calendar)this.Calendar.MinDate=date;
		var text=(date!=null)?date.getFullYear()+','+(date.getMonth()+1)+','+date.getDate():'null';
		ig_ClientState.setPropertyValue(this.stateNode,"MinDate",text);
		this.updatePostField();
	}
	me.getMinDate=function(){return this.editor.getMinValue();}
	me.getNullDateLabel=function(){return this.editor.getNullText();}
	me.setNullDateLabel=function(text)
	{
		this.editor.setNullText(text);
		ig_ClientState.setPropertyValue(this.stateNode,"NullDateLabel",text);
		this.updatePostField();
	}
	me.showCalendar=function(){this.setDropDownVisible(true);}
	me.hideCalendar=function(){this.setDropDownVisible(false);}
	me.onDateSelected=function(cal,date)
	{
		var me=cal.ownerDC;
		if(!me.Dropped)return;
		me.setValue(date,true);
		if(me.getAutoCloseUp())me.setDropDownVisible(false,true);
		if(!me.isEditable()|| me.getAutoCloseUp())me.setFocusTop();
	}
	me.setValue=function(date,fireEvent){this.editor.setDate(date);this.updateValue(this.editor.getText(),!fireEvent);}
	me.getValue=function(){return this.editor.getDate();}
	me.Events.InitializeDateChooser=me.Events.InitializeCombo;
	var cal=me.Calendar=ig_csom.isEmpty(calID)?null:igcal_getCalendarById(calID);
	if(cal!=null){cal.ownerDC=me;cal.onValueChanged=me.onDateSelected;me.elemCal=cal.element;}
	ig_fireEvent(me,me.Events.InitializeDateChooser[0],me,me.Id);
	me.Loaded=true;
	return me;
}
function igdc_initDateChooser(id,calID){return igdc_dateChooser(ig_csom.getElementById(id),eval("igdrp_"+id+"_Props"),calID);}
function ig_DateFormatInfo(a)
{
	this.DayNames=a[0];
	this.AbbreviatedDayNames=a[1];
	this.MonthNames=a[2];
	this.AbbreviatedMonthNames=a[3];
	this.FullDateTimePattern=a[4];
	this.LongDatePattern=a[5];
	this.LongTimePattern=a[6];
	this.MonthDayPattern=a[7];
	this.RFC1123Pattern=a[8];
	this.ShortDatePattern=a[9];
	this.ShortTimePattern=a[10];
	this.SortableDateTimePattern=a[11];
	this.UniversalSortableDateTimePattern=a[12];
	this.YearMonthPattern=a[13];
	this.AMDesignator=a[14];
	this.PMDesignator=a[15];
	this.DateSeparator=a[16];	
	this.TimeSeparator=a[17];
}
//<INPUT>,ig_DateFormatInfo,date,longDateFormat
function igmask_date(e,di,v,lf,nullTxt,nullable)
{
	if(e==null)return;
	this.changed=false;
	this.extra=new Object();
	this.nullText=nullTxt;
	this.allowNull=nullable;
	this.repaint0=function(fire)
	{
		if((this.k0==null)||(this.changed && this.elem.value==this.text))return;
		this.elem.value=this.text;
		if(!fire)return;
		this.changed=true;
		this.fireEvt(10,null);
	}
	var id=e.id;
	ig_csom.addEventListener(e,"keydown",igmask_event,false);
	ig_csom.addEventListener(e,"keypress",igmask_event,false);
	ig_csom.addEventListener(e,"keyup",igmask_event,false);
	ig_csom.addEventListener(e,"focus",igmask_event,false);
	ig_csom.addEventListener(e,"blur",igmask_event,false);
	ig_csom.addEventListener(e,"mousedown",igmask_event,false);
	ig_csom.addEventListener(e,"mouseup",igmask_event,false);
	ig_csom.addEventListener(e,"mousemove",igmask_event,false);
	ig_csom.addEventListener(e,"mouseover",igmask_event,false);
	ig_csom.addEventListener(e,"mouseout",igmask_event,false);
	this.id=id;
	e.setAttribute("maskID",id);
	this.elem=e;
	if(e.createTextRange!=null)this.tr=e.createTextRange();
	this.getElement=function(){return this.elem;}
	this.k1=0;
	this.fixKey=0;
	this.useLastGoodValue=true;
	this.getEnabled=function(){return this.elem.disabled!=true;}
	this.getReadOnly=function(){return this.elem.readOnly;}
	this.getText=function(){return this.text;}
	this.getMaxValue=function(){return this.max;}
	this.setMaxValue=function(v){this.max=v;}
	this.getMinValue=function(){return this.min;}
	this.setMinValue=function(v){this.min=v;}
	this.getNullText=function(){return this.nullText;}
	this.setNullText=function(v){this.nullText=v;}
	this.delta=1;
	//
	this.doKey=function(e,a)
	{
		if(a==1 && (e.ctrlKey || e.altKey))return;
		var k=e.keyCode;
		if(k==0 || k==null)if((k=e.which)==null)return;
		if(k<32 && k!=8)return;
		if(a==1)this.k1=k;
		var t0=this.text,t1=this.elem.value;
		var i=t1.length;
		if(a==2)
		{
			this.k1=0;
			if(this.k0<32)return;
			if(t0!=t1)
			{
				this.changed=true;
				if(this.fixKey>0 || i==1)this.afterKey(k,this.fixKey++==1);
				else if(this.fixKey==0)if(i--==0){this.fixKey=2;return;}
			}
			this.k0=-2;
			return;
		}
		switch(k)
		{
			//end//right//home//left
			case 35:case 39:case 36:case 37:if(this.k1==k)return;break;
			//back//del
			case 8:case 46:if(this.k1==k)return;break;
			//up//down
			case 38:case40:
				if(a==1 && this.delta!=0 && !e.shiftKey)this.spin((k==38)?this.delta:-this.delta);
				if(this.k1==k)return;break;
		}
		if(a==1)
		{
			t0=this.getSelectedText();
			if(t0.length>0 || this.sel0<i)this.fixKey=0;
			else if(this.fixKey==0 && this.sel0==i)this.fixKey=1;
			return;
		}
		// fast typing!
		if(this.k0>0)
		{
			if(t0!=t1)this.changed=true;
			if(this.fixKey>0)
				this.afterKey(this.k0,this.fixKey>0);
		}
		var newK=this.filterKey(k,this.fixKey>0);
		if(newK!=k && this.tr==null)newK=0;
		if(newK==0)ig_cancelEvent(e);
		else if(newK!=k && this.tr!=null)e.keyCode=newK;
		this.k0=newK;
	}
	this.stoi=function(s)
	{
		switch(s.toLowerCase())
		{
			case "keypress":return 0;
			case "keydown":return 1;
			case "keyup":return 2;
			case "mousedown":return 3;
			case "mouseup":return 4;
			case "mousemove":return 5;
			case "mouseover":return 6;
			case "mouseout":return 7;
			case "focus":return 8;
			case "blur":return 9;
			case "invalidvalue":return 11;
		}
		return 10;//valuechanged
	}
	this.doEvtM=function(e)
	{
		if(e==null || !this.getEnabled())return;
		var v=!this.getReadOnly(),a=this.stoi(e.type);
		if(a<8)this.fireEvt(a,e);
		if(a<3 && v)this.doKey(e,a);
		if(a>=8)
		{
			if((a==8)==this.foc)return;
			this.foc=(a==8);
			if(a==9 && v)
			{
				if(!this.changed)this.changed=this.text!=this.elem.value;
				if(this.changed)
				{
					this.text=this.elem.value;
					if(this.elem.onchange!=null)this.elem.onchange();
				}
			}
			if(a==8 && v)
			{
				if(this.useLastGoodValue)this.setGood();
				if((v=this.elem.value)!=this.text){this.paste(v);return;}
			}
			this.repaint(a==9 && this.changed);
			this.fireEvt(a,e);
			if(this.foc){this.changed=false;this.select();}
			return;
		}
		if((v=this.elem.value)!=this.text && (this.k1==0 || a<4))
		{
			this.changed=true;
			if(a>3 && this.k1==0)this.paste(v);
			else this.text=v;
			this.fireEvt(10,e);
		}
	}
	this.events=new Array(11);
	this.evtH=function(n,f,add)
	{
		n=this.stoi(n);
		var e=this.events[n];
		if(e==null){if(add)e=this.events[n]=new Array();else return;}
		n=e.length;
		while(n-->0)if(e[n]==f){if(!add)e[n]=null;return;}
		if(add)e[e.length]=f;
	}
	this.removeEventHandler=function(name,fref){this.evtH(name,fref,false);}
	this.addEventHandler=function(name,fref){this.evtH(name,fref,true);}
	this.fireEvt=function(id,e)
	{
		var evts=this.events[id];
		var i=(evts==null)?0:evts.length;
		if(i==0)return false;
		var evt=this.Event;
		if(evt==null)evt=this.Event=new ig_EventObject();
		var cancel=false;
		while(i-->0)
		{
			if(evts[i]==null)continue;
			evt.reset();
			evt.event=e;
			evts[i](this,this.elem.value,evt,this.extra);
			if(evt.cancel)cancel=true;
		}
		return cancel;
	}
	this.select=function(s0,s1)
	{
		var i=this.elem.value.length;
		if(s1==null)if((s1=s0)==null){s0=0;s1=i;}
		if(s1>=i)s1=i;
		else if(s1<s0)s1=s0;
		if(s0>s1)s0=s1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -