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

📄 control.js

📁 vc-mfc编程实例 很简单的东西,以后回多传自己的东西
💻 JS
📖 第 1 页 / 共 5 页
字号:
				obj.hightLightValue=obj.options[ii];
				var arr1=this.id.split("_");
				var showid=(arr1[arr1.length-1]*1);
				if (!isNaN(showid))
				{
					var downObj=document.getElementById("selecthtml")
					var trArr=(downObj.childNodes[0].childNodes[0].childNodes)
					for (var i=0;i<trArr.length;i++)
					{
						trArr[i].style.backgroundColor="";
						trArr[i].style.color="#000000"
					}
					this.style.backgroundColor="#000099"
					this.style.color="#ffffff"
					//alert(downObj.scrollTop);
					//downObj.scrollTop=20;
					var scrollTopVal=((showid+1)*20-obj.height)
					if (scrollTopVal>0)
					{
						//downObj.scrollTop=scrollTopVal;
					}
					obj.selectedIndex=showid+1;
					obj.previousSelectId=showid;
				}
			}
		}
		
		
		for (i=0;i<combo.options.length;i++)
		{
			var mouseObj=document.getElementById(this.excusiveId+"_"+i);
			mouseObj.onmouseover=this.getDownListMouseoverFun(this,i);
		}
		
    	
    	vtop=pDiv.offsetTop+pDiv.offsetHeight-4;
    	vleft=pDiv.offsetLeft+1
    
    
    	vParent = pDiv.offsetParent;
		
    	while (vParent.tagName.toUpperCase() != "BODY")
		{
			var scroTop=vParent.scrollTop;
			vleft += vParent.offsetLeft;
			vtop += (vParent.offsetTop-scroTop);
			vParent = vParent.offsetParent;
		}

   		var redge=document.body.clientWidth-vleft
   		var bedge=document.body.clientHeight-vtop
 
  	

		if (!combo.width) {vDiv.style.width=pTable.offsetWidth} else {vDiv.style.width=combo.width}
    

    	if (combo.height==0)
      	{
        	vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
        	vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
      	}
      	else
      	{
         	if (htmltable.offsetHeight>combo.height)
          	{
            	vDiv.style.pixelHeight=combo.height
            	vDivHtml.style.pixelHeight=combo.height
            } 
           	else 
           	{
          
              	vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
              	vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
           	}
       	}
    
    	vDivHtml.scrollTop=0
    
    	if (redge<vDiv.offsetWidth)
      		vDiv.style.left=vleft-1-(vDiv.offsetWidth-redge)+3
        else
      		vDiv.style.left=vleft-1+4
      

   		if (bedge<vDiv.offsetHeight)
    		//vDiv.style.top=vtop-vDiv.offsetHeight-pDiv.offsetHeight
    		vDiv.style.top=vtop-vDiv.offsetHeight-20
    		
         else
      		vDiv.style.top=vtop
      
    
    	vDivHtml.style.width=parseInt(vDiv.style.width)-6
      	vDiv.style.visibility="visible";
		document.getElementById("selecthtml").scrollTop="0px";
		if (this.hasFirstDropDown==false)
		{
			this.hasFirstDropDown=true;
			this.show(showid);
		}
  	}
  
  	this.add=function(text,value)
  	{
     	combo.options[combo.options.length]=text+"|&"+value
  	}
  
  	this.about=function()
	{
  		alert("Drop down list for AOL");
 	}
	
	//////////////////////////////////////////
	this.onSelectChangeFunction=function()
	{
		
	}
	this.firstChangeValue=false;
	this.getInputBoxChangeFunction=function(obj)//// on input box value change
	{
		return function()
		{
			if (event.propertyName!="value")
			{
				return;
			}
			////////////////////////////// dropdown list change event call the fllow function
			obj.onValueChange();
		}
	}
	document.getElementById(this.buttonname+'_input').onpropertychange=this.getInputBoxChangeFunction(this);
	this.onValueChange=function()
	{
		
	}
}


	function mo(obj)
	{
		obj.style.backgroundColor="#000099"
		obj.style.color="#ffffff"
	}

	function mu(obj)
	{
		obj.style.backgroundColor=""
		obj.style.color="#000000"
	}

	function onClickItem(itemObj,mainText,hiddenObj,name)
	{
		mainText.value=itemObj.innerText;
		hiddenObj.style.visibility="hidden";
		setSelectValue(itemObj.fvalue,name);
	}


	function setSelectValue(value,name)
	{
		var scriptObj=document.getElementById("downlist_script_"+name);
		scriptObj.value=value;
		scriptObj.onChange();
	}


	function mouseDownFun2()
	{
		return function()
		{
			
			if (vDiv.style.visibility=="visible")
			{
				mx=event.x + document.body.scrollLeft
				my=event.y + document.body.scrollTop;
				
				x1=vDiv.offsetLeft
				y1=vDiv.offsetTop
				
				x2=vDiv.offsetLeft+vDiv.offsetWidth
				y2=vDiv.offsetTop+vDiv.offsetHeight
				
				if (mx<x1 || my<y1 || x2<mx || y2<my) 
				{ 
					vDiv.style.visibility='hidden'
				}
			}
		}
	}
	document.attachEvent("onmousedown",mouseDownFun2());


///////////////////////////Class checkBox()////////////////////////////
//  			checkBox(string parentNodeId,bool isChecked)
//					parentNodeId:		Where you want the checkBox to be append, it's the parent node's id.
//					isChecked:			default value
//				---------------------------------------------------
//  method		apply()					To display the checkBox
//				Enable()
//				Disable()
//				setChecked(bool ischeck)	Check or Uncheck the CheckBox
//				setPartCheck()			Partly check
//				----------------------------------------------------
//	porperty	checked					
//				isEnable
//				partCheck
//				----------------------------------------------------
//  event		onClick
//				onCheck
//				onUncheck
//
/////////////////////////////////////////////////////////////////

var checkBox=function(parentNodeId,isChecked)
{

	this.pid=parentNodeId;
	this.element=document.createElement("div");
	this.element.cssFloat="left";
	this.element.style.width="12";
	this.element.style.height="12";
	this.element.innerHTML="<img width=1 height=1 src='' />"
	this.isEnable=true;
	this.flag="";
	this.data="";
	this.partCheck=false;
	
	this.checked=isChecked==true?true:false;
	this.onClick=function(){}
	this.onCheck=function(){}
	this.onUncheck=function(){}
	
	///Flannian Begin--处理Flag,Value
	this.setFlag=function(flag)
	{
		this.flag=flag;
	}
	
	this.setData=function(data)
	{
		this.data=data;
	}
	///Flannian End--	
	
	this.setChecked=function(isChecked)
	{
		if (this.isEnable==false)
		{
			return;	
		}
		this.checked=isChecked==true?true:false;
		this.partCheck=false;
		if (this.checked)
		{	
			this.element.style.backgroundImage="url(checkboximages/checkbox_checked.jpg)";
			this.onCheck();
		}
		else
		{	
			this.element.style.backgroundImage="url(checkboximages/checkbox_notchecked.jpg)";
			this.onUncheck();
		}
	}
	
	this.setPartCheck=function()
	{
		if (this.isEnable==false)
		{
			return;	
		}
		this.partCheck=true;
		this.checked=true;
		this.element.style.backgroundImage="url(checkboximages/checkbox_part.jpg)";
	}
	
	if (this.checked)
	{
		
		this.element.style.backgroundImage="url(checkboximages/checkbox_checked.jpg)";
	}
	else
	{
		this.element.style.backgroundImage="url(checkboximages/checkbox_notchecked.jpg)";
	}
	
	
	this.apply=function()
	{
		document.getElementById(this.pid).appendChild(this.element);
		return this.element;
	}
	this.cbClick=function(obj)
	{
		return function()
		{
			obj.onClick();
			if (obj.isEnable==false)
			{

			}
			else
			{
				obj.partCheck=false;
				if(obj.checked)
				{
					obj.checked=false;
					obj.element.style.backgroundImage="url(checkboximages/checkbox_notchecked.jpg)";	
					obj.onUncheck();
				}
				else
				{
					obj.checked=true;
					obj.element.style.backgroundImage="url(checkboximages/checkbox_checked.jpg)";
					obj.onCheck();
				}
			}
			
		}
	}
	this.Disable=function()
	{
		this.isEnable=false;
		if (this.checked)
		{
			if (this.partCheck)
			{
				this.element.style.backgroundImage="url(checkboximages/checkbox_part_dis.jpg)";
			}
			else
			{
				this.element.style.backgroundImage="url(checkboximages/checkbox_checked_dis.jpg)";
			}
		}
		else
		{
			this.element.style.backgroundImage="url(checkboximages/checkbox_notchecked_dis.jpg)";
		}
	}
	
	this.Enable=function()
	{
		this.isEnable=true;
		if (this.checked)
		{
			if (this.partCheck)
			{
				this.element.style.backgroundImage="url(checkboximages/checkbox_part.jpg)";
			}
			else
			{
				this.element.style.backgroundImage="url(checkboximages/checkbox_checked.jpg)";
			}
		}
		else
		{
			this.element.style.backgroundImage="url(checkboximages/checkbox_notchecked.jpg)";	
		}

	}
	
	
	this.element.onclick=this.cbClick(this);
	
	
}

///////////////////////////applyButton()   function///////////////////////////
//
//Apply Button to page
//		It will change the IE default button style to the custom style.
//		it support onClick event, support enable and disable porperty.
//
//
//
//
//////////////////////////////////////////////////


//-------------------------------------------------------------------------

	  
function applyButton()
{
	var a=document.getElementsByTagName("button")
	var tmpBtObj;
	var RIT_btArr=new Array();
	for (i=0;i<a.length;i++)
	{
		if (a[i].cstyle!="rit") continue;
		a[i].style.display="none";
		RIT_btArr[i]=new RITButton(a[i].id,a[i].innerHTML);
		RIT_btArr[i].attachObj(a[i]);
		a[i].insertAdjacentHTML("beforeBegin",RIT_btArr[i].getHTML());
		document.getElementById(RIT_btArr[i].btID+"_RIT").onclick=Rit_button_getClickFun(RIT_btArr[i]);
		document.getElementById(RIT_btArr[i].btID+"_RIT").onmousedown=Rit_button_getMouseDownFun(RIT_btArr[i]);
		document.getElementById(RIT_btArr[i].btID+"_RIT").onmouseup=Rit_button_getMouseUpFun(RIT_btArr[i]);
		document.getElementById(RIT_btArr[i].btID+"_RIT").onmouseout=Rit_button_getMouseOutFun(RIT_btArr[i]);
	}
}

function Rit_button_getClickFun(ritBtObj)
{
	return function()
	{
		if(ritBtObj.btObj.dsiabled)
		{
			return;	
		}
		document.getElementById(ritBtObj.btID).click();	
	}
}

function Rit_button_getMouseDownFun(ritBtObj)
{
	
	return function()
	{
		
		if(ritBtObj.btObj.dsiabled)
		{
			return;	
		}
		button_switchStatus(1,"",document.getElementById(ritBtObj.btID+"_RIT"))	;	
	}
}

function Rit_button_getMouseUpFun(ritBtObj)
{
	return function()
	{
		if(ritBtObj.btObj.dsiabled)
		{
			return;	
		}
		button_switchStatus(0,"",document.getElementById(ritBtObj.btID+"_RIT"))	;	
	}
}

function Rit_button_getMouseOutFun(ritBtObj)
{
	return function()
	{
		if(ritBtObj.btObj.dsiabled)
		{
			return;	
		}
		button_switchStatus(0,"",document.getElementById(ritBtObj.btID+"_RIT"))	;
	}
}

⌨️ 快捷键说明

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