人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細(xì)頁面

可以編輯的Select

可以編輯的Select

更新時間:2021-01-01 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

<script src="editableselect.js"></script>
<select id="EditableSelect">
<option>可以編輯的select第二版</option>
<option>Bencalie制作</option>
</select>

=======================
editableselect.js

window.onload=function(){
 var objSelect=EditableSelect
 var obj=document.all.EditableSelect
 getTop=obj.offsetTop;
 getLeft=obj.offsetLeft;
 while(objSelect=objSelect.offsetParent){
 getTop+=objSelect.offsetTop;
 getLeft+=objSelect.offsetLeft;
 }

 var oNewItem=document.createElement("OBJECT"); 
 document.body.insertBefore(oNewItem);
 oNewItem.outerHTML="<object id=editable style=\"z-index:2;position:absolute\" type=\"text/x-scriptlet\" data=\"addin2.htm\"></object>";

 editable.style.left=getLeft+1
 editable.style.top=getTop+1
 editable.style.width=obj.offsetWidth-19
 editable.style.height=obj.offsetHeight-3
 
 obj.onchange=function(){editable.str(obj.options[obj.selectedIndex].text)}
 obj.onresize=function(){editable.style.width=obj.offsetWidth-19}
}

function addNewOption(value){
 EditableSelect.options[EditableSelect.length]=new Option(value,value)
}

=======================
addin2.htm

<script language="vbs">
function public_str(theStrIn)
 strIn.value=theStrIn
end function
</script>
<body leftmargin=0 topmargin=0>
<script language="javascript">
function check(){
var obj=parent.document.all.EditableSelect
var theValue=document.all.strIn.value.replace(/^\s*/g,"").replace(/\s*$/g,"")
if(event.keyCode==13){
if(theValue!=""){
for(i=0;i<obj.length;i++)
 if(obj.options[i].text==theValue){
  alert("該選項已經(jīng)存在!");
  document.all.strIn.focus();
  document.all.strIn.value="";
  return;
 }
parent.addNewOption(theValue) 
}
document.all.strIn.value=""
}
}
</script>
<input id=strIn style='border:0;width:100%;height:100%;padding-top:2px' onkeydown=check()>
</body>



溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 涟源市| 辰溪县| 台中县| 昭苏县| 翁牛特旗| 报价| 阿坝县| 昌都县| 九龙坡区| 乐陵市| 九江市| 朔州市| 虞城县| 黎川县| 彰武县| 铜川市| 忻州市| 监利县| 库车县| 沅江市| 湄潭县| 新建县| 江陵县| 宁都县| 津市市| 色达县| 新营市| 岗巴县| 罗甸县| 钟山县| 余姚市| 丹东市| 丰台区| 伊宁县| 廉江市| 宁海县| 会东县| 东乡| 巴东县| 梁山县| 巴楚县|