|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。select1、
<HTML>
<HEAD>
<PUBLIC>
<COMPONENTTAGNAME="COMBOBOX">
<PROPERTYNAME="Text"GET="get_Text"PUT="put_Text">
<PROPERTYNAME="Width"GET="get_Width"PUT="put_Width">
<METHODNAME="SetFocus"INTERNALNAME="htcFocus">
<METHODNAME="AddItems"INTERNALNAME="htcAddItems">
<EVENTNAME="onYYCenter"ID="idEnter">
<EVENTNAME="onYYCChoose"ID="idChoose">
<ATTACHEVENT="oncontentready"ONEVENT="htcInit()">
</COMPONENT>
</PUBLIC>
<SCRIPTLANGUAGE="javascript">
functionhtcInit()
{
defaults.viewLink=document;
defaults.viewInheritStyle=false;
Body_Init();
}
functionhtcAddItems(items)
{
vari,len;
len=pCombo.options.length;
for(i=0;i<len;i++)
{pCombo.remove(0);}
for(i=0;i<items.length;i++)
{
varo;
if((typeofitems[i])==string)
{
if(!HasTheValue(items,i))
{
o=document.createElement(OPTION);
o.text=items[i];
pCombo.add(o);
}
}
}
}
functionhtcFocus()
{
pText.focus();
}
functionget_Text()
{
returnpText.value;
}
functionput_Text(Value)
{
pText.value=Value;
}
functionget_Width()
{
returnpCombo.style.width;
}
functionput_Width(Value)
{
pCombo.style.width=Value;
}
</SCRIPT>
<SCRIPTLANGUAGE="javascript">
functionBody_Init()
{
variRight=pCombo.clientWidth;
variBottom=pCombo.clientHeight;
variLeft=(pCombo.clientWidth-18);
pCombo.style.clip=rect(0,+iRight+,+iBottom+,+iLeft+);
pText.style.width=(pCombo.clientWidth);
pText.style.height=(pCombo.clientHeight);
pText.style.top=0;
pText.style.left=0;
}
functionCombo_Select()
{
pText.value=pCombo.options[pCombo.selectedIndex].text;
}
functionText_ChkKey()
{
if(event.keyCode==13)
{
idEnter.fire();
}
}
functionHasTheValue(sitems,i)
{
varii;
for(ii=0;ii<i;ii++)
{
if(sitems[ii]==sitems[i])
returntrue;
}
returnfalse;
}
</SCRIPT>
</HEAD>
<BODY>
<SELECTSTYLE="position:absolute;left:0;top:0;"ONCHANGE="Combo_Select()"NAME="pCombo">
</SELECT>
<INPUTSTYLE="position:absolute;left:0;top:0;z-index:4000"onKeyPress="Text_ChkKey()"TYPE="TEXT"NAME="pText">
</BODY>
</HTML>
2、
functiongetLeftPostion(theObj)
{
varpos=0;
while(theObj!=null)
{
pos+=theObj.offsetLeft;
//gettheObjectwhichcontaintheObj.
theObj=theObj.offsetParent;
}
returnpos;
}
functiongetTopPostion(theObj)
{
varpos=0;
while(theObj!=null)
{
pos+=theObj.offsetTop;
//gettheObjectwhichcontaintheObj.
theObj=theObj.offsetParent;
}
returnpos;
}
functioncheckVersion()
{
varisBadVersion=true;
varcurVer=navigator.appVersion;
varpos=parseInt(curVer.indexOf("MSIE"));
if(pos>=1)
{
varintVer=parseInt(curVer.charAt(pos+5));
if(intVer>=5)
{isBadVersion=false;}
}
if(isBadVersion)
{
varmsg="Thispagemaynotbedisplayedproperly:
"+
"ThisproductrequiresMicrosoftInternetExplorer5orlaterbrowseronly.";
alert(msg);
}
}
//checkthebrowserversion
checkVersion();
//thearrayofcomboBoies
theArray=newArray();
functioncombobox(objId,objHandler)
{
this.comObj=document.all[objId];
this.comObj.selectedIndex=-1;
this.getValue=getValue;
this.doResize=doResize;
this.doChange=doChange;
this.loseFocus=loseFocus;
this.doSelectIdx=doSelectIdx;
this.focus=focus;
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全 |
|