具有edit功能的combobox
<HTML><HEAD>
<PUBLIC>
<COMPONENT TAGNAME="COMBOBOX">
<PROPERTY NAME="Text" GET="get_Text" PUT="put_Text">
<PROPERTY NAME="Width" GET="get_Width" PUT="put_Width">
<METHOD NAME="SetFocus" INTERNALNAME="htcFocus">
<METHOD NAME="AddItems" INTERNALNAME="htcAddItems">
<EVENT NAME="onYYCenter" ID="idEnter">
<EVENT NAME="onYYCChoose" ID="idChoose">
<ATTACH EVENT="oncontentready" ONEVENT="htcInit()">
</COMPONENT>
</PUBLIC>
<SCRIPT LANGUAGE="javascript">
function htcInit()
{
defaults.viewLink=document;
defaults.viewInheritStyle=false;
Body_Init();
}
function htcAddItems(items)
{
var i,len;
len=pCombo.options.length;
for(i=0;i<len;i++)
{pCombo.remove(0);}
for(i=0;i<items.length;i++)
{
var o;
if((typeof items[i])=='string')
{
if(!HasTheValue(items,i))
{
o=document.createElement('OPTION');
o.text=items[i];
pCombo.add(o);
}
}
}
}
function htcFocus()
{
pText.focus();
}
function get_Text()
{
return pText.value;
}
function put_Text(Value)
{
pText.value=Value;
}
function get_Width()
{
return pCombo.style.width;
}
function put_Width(Value)
{
pCombo.style.width=Value;
}
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
function Body_Init()
{
var iRight=pCombo.clientWidth;
var iBottom=pCombo.clientHeight;
var iLeft=(pCombo.clientWidth-18);
pCombo.style.clip='rect(0,'+iRight+','+iBottom+','+iLeft+')';
补充:asp教程,技巧与性能优化