<script> <br> function opts(selectObj){ <br> var optDivs=document.createElement("div"); <br> var objTable=document.createElement("table"); <br> var objTbody=document.createElement("tbody"); <br> optDivs.style.zIndex = "100"; <br> objTable.style.zIndex = "100"; <br> objTable.width=selectObj.style.width; <br> objTable.border = "0"; <br> objTable.cellPadding = "0"; <br> objTable.cellSpacing = "0"; <br> objTable.style.paddingLeft = "2"; <br> objTable.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif"; <br><br> var e = selectObj; <br> var absTop = e.offsetTop; <br> var absLeft = e.offsetLeft; <br> var absWidth = e.offsetWidth; <br> var absHeight = e.offsetHeight; <br><br> while(e = e.offsetParent){ <br> absTop = (e.offsetTop 0.3); <br> absLeft = e.offsetLeft; <br> }<br><br> with (objTable.style){ <br> position = "absolute"; <br> top = (absTop absHeight) "px"; <br> left = (absLeft 1) "px"; <br> border = "1px solid black"; <br> tableLayout="fixed"; <br> wordBreak="break-all"; <br> } <br><br> var options = selectObj.options; <br> var val=selectObj.value; <br><br> if (options.length > 0){ <br> for (var i = 0; i < options.length; i ){ <BR> var newOptDiv = document.createElement("td"); <BR> var objRow=document.createElement("tr"); <BR> newOptDiv.name=options[i].value; <BR> newOptDiv.innerText=options[i].innerText; <BR> newOptDiv.title=options[i].title; <BR> newOptDiv.onmouseout = function() {this.className='smouseOut';val=selectObj.value}; <BR> newOptDiv.onmouseover = function() {this.className='smouseOver';val=this.name;}; <BR> newOptDiv.className="smouseOut"; <BR> newOptDiv.style.width=40; <BR> newOptDiv.style.cursor="default"; <BR> newOptDiv.style.fontSize = "11px"; <BR> newOptDiv.style.fontFamily = "Verdana, Arial, Helvetica, sans-serif"; <br><br> objRow.appendChild(newOptDiv); <BR> objTbody.appendChild(objRow); <BR> } <BR> } <br><br> <BR> objTbody.appendChild(objRow); <BR> objTable.appendChild(objTbody); <BR> optDivs.appendChild(objTable); <BR> document.body.appendChild(optDivs); <br><br> var IfrRef = document.createElement("div"); <BR> IfrRef.style.position="absolute"; <BR> IfrRef.style.width = objTable.offsetWidth; <BR> IfrRef.style.height = objTable.offsetHeight; <BR> IfrRef.style.top = objTable.style.top; <BR> IfrRef.style.left = objTable.style.left; <BR> IfrRef.style.backgroundColor = document.bgColor; <BR> document.body.appendChild(IfrRef); <br><br> objTable.focus(); <BR> objTable.onblur=function() {choose(selectObj,val,optDivs,IfrRef)}; <BR> }<br><br> function choose(objselect,val,delobj,delobj2){ <BR> objselect.value=val; <BR> document.body.removeChild(delobj); <BR> document.body.removeChild(delobj2); <BR> } <br><br> </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn