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

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

可以編輯的Select

可以編輯的Select

更新時間:2021-01-01 文章作者:未知 信息來源:網絡 閱讀次數:

<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("該選項已經存在!");
  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>



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

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 卓尼县| 珠海市| 偏关县| 深泽县| 霸州市| 醴陵市| 同江市| 微博| 兰坪| 筠连县| 呼和浩特市| 万安县| 辽阳县| 油尖旺区| 济阳县| 清原| 淮南市| 元谋县| 泗洪县| 乐至县| 沈阳市| 昌邑市| 延川县| 鄂尔多斯市| 宁乡县| 会同县| 隆子县| 依安县| 江源县| 牙克石市| 林西县| 闵行区| 枝江市| 德格县| 兴宁市| 衡阳县| 沙河市| 永胜县| 四川省| 庐江县| 阿瓦提县|