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

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

為 Html 的 Select 加一個提示語與輸入辦法

為 Html 的 Select 加一個提示語與輸入辦法

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


<Html>
<Head>
<SCRIPT LANGUAGE="JavaScript">
<!--
//定義 select 原值
var oldValue,oldText;
//select下拉框的onkeydown事件,修改下拉框的值
function catch_keydown(sel)
{
switch(event.keyCode)
{
case 13: //回車鍵
event.returnValue = false;
break;
case 27: //Esc鍵
sel.options[sel.selectedIndex].text = oldText;
sel.options[sel.selectedIndex].value = oldValue;
event.returnValue = false;
break;
case 8: //空格健
var s = sel.options[sel.selectedIndex].text;
s = s.substr(0,s.length-1);
if (sel.options[sel.selectedIndex].value==sel.options[sel.selectedIndex].text)
{
sel.options[sel.selectedIndex].value=s;
sel.options[sel.selectedIndex].text=s;
}
event.returnValue = false;
break;
}
if (!event.returnValue && sel.onchange)
sel.onchange(sel)
}

//select下拉框的onkeypress事件,修改下拉框的值
function catch_press(sel){
if(sel.selectedIndex>=0){
var s = sel.options[sel.selectedIndex].text + String.fromCharCode(event.keyCode);
if (sel.options[sel.selectedIndex].value==sel.options[sel.selectedIndex].text)
{
sel.options[sel.selectedIndex].value=s;
sel.options[sel.selectedIndex].text=s;
}
event.returnValue = false;
if (!event.returnValue && sel.onchange)
sel.onchange(sel)
}
}

//select下拉框的onfocus事件,保存下拉框原來的值
function catch_focus(sel) {
oldText = sel.options[sel.selectedIndex].value;
oldValue = sel.options[sel.selectedIndex].value;
}

//恢復select下拉列表當前選中的值
function LoadSelect(obj,value)
{
for (var i=0; i< obj.options.length; i++)
if (obj.options[i].value == value)
{
obj.selectedIndex = i;
break;
}
}

//select 選擇框鼠標上移時提示選擇的內容
function selMouseOver(obj)
{
with (document.all.div_hint)
{
innerText = obj.options[obj.selectedIndex].text;
if (innerText.length > 0)
{
innerText = " " + innerText + " ";
style.display = "block";
style.left = event.clientX + 16;
style.top = event.clientY;
}
}
}

//select 選擇框鼠標移開時消失
function selMouseOut(obj)
{
with (document.all.div_hint)
{
style.display = "none"
}
}
//-->
</SCRIPT>
</Head>
<Body>
<!--調用-->
<select style='width:130px;z-index:-1' name='tmpSel' onmouseover=selMouseOver(this) onmouseout=selMouseOut(this) onkeydown=catch_keydown(this) onkeypress=catch_press(this) onfocus=catch_focus(this)>
<option value=''></option>
</select>

<!--提示塊-->
<div id=div_hint style="font-size:12px;color:red;display:none;position:absolute; z-index:2; top:200;background-color: #F7F7F7; layer-background-color: #0099FF; border: 1px #9c9c9c solid;filter:Alpha(style=0,opacity=80,finishOpacity=100);"></div>
</Body>
</Html>


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

本類教程下載

系統(tǒng)下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 庄浪县| 原阳县| 罗城| 叶城县| 昆明市| 通渭县| 龙岩市| 荣昌县| 定襄县| 襄樊市| 横峰县| 潢川县| 天祝| 当雄县| 丰县| 东安县| 武汉市| 波密县| 许昌市| 射阳县| 金门县| 龙山县| 阜阳市| 永宁县| 湖北省| 永兴县| 荃湾区| 怀安县| 陕西省| 盐边县| 青河县| 广元市| 曲靖市| 阿图什市| 藁城市| 怀安县| 鄂伦春自治旗| 曲麻莱县| 克山县| 龙海市| 阳原县|