一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

js下用層來實現select的title提示屬性

復制代碼 代碼如下:
<script>
             function opts(selectObj){
                         var optDivs=document.createElement("div");
                         var objTable=document.createElement("table");
                         var objTbody=document.createElement("tbody");
                         optDivs.style.zIndex = "100";
                         objTable.style.zIndex = "100";
                         objTable.width=selectObj.style.width;    
                         objTable.border = "0";
                         objTable.cellPadding = "0";
                         objTable.cellSpacing = "0";
                         objTable.style.paddingLeft = "2";    
                         objTable.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif";

                         var e = selectObj;
                         var absTop = e.offsetTop;
                         var absLeft = e.offsetLeft;
                         var absWidth = e.offsetWidth;
                         var absHeight = e.offsetHeight;

                         while(e = e.offsetParent){
                         absTop += (e.offsetTop+0.3);
                         absLeft += e.offsetLeft;
                         }

                         with (objTable.style){
                         position = "absolute";
                         top = (absTop + absHeight) + "px";
                         left = (absLeft+1) + "px";
                         border = "1px solid black";
                         tableLayout="fixed";
                         wordBreak="break-all";
                         }

                         var options = selectObj.options;
                         var val=selectObj.value;

                            if (options.length > 0){
                                 for (var i = 0; i < options.length; i++){
                                     var newOptDiv = document.createElement("td");
                                     var objRow=document.createElement("tr");
                             newOptDiv.name=options[i].value;
                             newOptDiv.innerText=options[i].innerText;
                             newOptDiv.title=options[i].title;
                             newOptDiv.onmouseout = function() {this.className='smouseOut';val=selectObj.value};
                             newOptDiv.onmouseover = function() {this.className='smouseOver';val=this.name;};
                             newOptDiv.className="smouseOut";
                             newOptDiv.style.width=40;
                             newOptDiv.style.cursor="default";
                             newOptDiv.style.fontSize = "11px";
                             newOptDiv.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif";

                             objRow.appendChild(newOptDiv);
                             objTbody.appendChild(objRow);
                             }
                            }

                    
                            objTbody.appendChild(objRow);
                            objTable.appendChild(objTbody);
                            optDivs.appendChild(objTable);
                            document.body.appendChild(optDivs);

                             var IfrRef = document.createElement("div");
                            IfrRef.style.position="absolute";
                            IfrRef.style.width = objTable.offsetWidth;
                            IfrRef.style.height = objTable.offsetHeight;
                            IfrRef.style.top = objTable.style.top;
                            IfrRef.style.left = objTable.style.left;
                            IfrRef.style.backgroundColor = document.bgColor;
                            document.body.appendChild(IfrRef);

                            objTable.focus();
                            objTable.onblur=function() {choose(selectObj,val,optDivs,IfrRef)};
         }

         function choose(objselect,val,delobj,delobj2){
             objselect.value=val;
             document.body.removeChild(delobj);
             document.body.removeChild(delobj2);
         }

         </script>

        
         <STYLE>
                    .smouseOut {
                            background: document.bgColor;
                            color: #000000;
                    }
                    .smouseOver {
                            background: rgb(0,128,128);
                            color: #FFFFFF;
                            cursor: pointer;
                    }
            </style>

        
         <select id='selId'    style='width:50px' class='black' onclick="opts(this);">
                <option value='1' title="One....">111</option>
                <option value='2' title="Two....">222</option>

            </select>

JavaScript技術js下用層來實現select的title提示屬性,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 思思久久q6热在精品国产 | 国产精品二区高清在线 | 激情五月五月婷婷 | 女性毛片 | 浮力影院第一页小视频国产在线观看免费 | 1024你懂的国产精品 | 综合图色 | 色偷偷人人澡久久天天 | 天干天干夜天干天天爽 | 91免费永久在线地址 | 伊人色综合久久天天 | 69国产成人综合久久精品91 | 最新国产视频 | 色多多在线观看视频 | 亚洲小说欧美激情另类 | 成年人午夜免费视频 | 白丝美女被狂躁视频免费网站 | 国产精品午夜久久 | 3久女bbbwww | 狠狠色伊人亚洲综合第8页 狠狠色伊人亚洲综合网站l | 久久久亚洲精品蜜桃臀 | 国产美女下面流出白浆视频 | 怡红院免费的全部视频 | 精品久久中文网址 | se视频在线观看 | 亚洲欧美国产18 | 国产欧美一区二区精品性色99 | 久久r热这里有精品视频 | 二区三区在线观看 | 激情综合丝袜美女一区二区 | 日韩美女毛片 | 国产精品视频99 | 91大神免费视频 | 五月婷婷综合在线 | 涩涩色视频在线播放 | 久久久久久久久网站 | 77se77亚洲欧美在线大屁股 | 69视频免费 | 免费黄色在线观看 | 一级毛毛片毛片毛片毛片在线看 | 成人在线免费视频观看 |