Ajax Auto-complete dropdown box automatically prompts position problem _ajax related

Source: Internet
Author: User
Tags tagname
Copy Code code as follows:

function Divposition () {
var clx,cly;
Clx=event.clientx;
cly = Event.clienty;
Objouter.style.top = clx+10;
Objouter.style.left = cly+20;
Objouter.style.width= Getabsolutewidth (Objinput)
}

The problem is
Objouter.style.top = clx+10;
Objouter.style.left = cly+20;
Objouter.style.width= getabsolutewidth (objinput);
If changed into Getabsolutetop (Objinput);
Getabsoluteleft (Objinput);
In the form of text box input dongdong is dead ie
But I don't know how to change it.


The position of the layer is not <script language= "JavaScript" > var intindex=0;arrlist = new Array (); function Dearray (AA)//defines array {//document.write (AA); Arrlist = Aa.split (', '); Intindex = arrlist.length} function test () {init (); Dearray ("asp,csdn,aaaa,bbbbc,afd,werwe,adfs,ertr,qwq,qwqwq,trt,uyus,dsfs,uere,add,234,2,1dr4,ae4564,adf4645, afa3543,sdfse5,ae345345,sdf4564,34346536 "); Smanpromptlist (Arrlist, "aspx"); Dearray ("1sdfsdf.com,a11sdafs.net,b22dsafsdf,c333asdfsadf,4444dsafasdf,dddsfddsafdsaf,121213dsafsdaf, 43213ASDFADSF,DSA3121DASF3,A213,323313,3213,32213,DSFSDDDD,DS11DFSFD,FFDAFD,AFDFD,AFD,BAFFAD,2FDA2FD,DASD "); Smanpromptlist (Arrlist, "aspx2"); Smanpromptlist (Arrlist, "Inputer")} function init () {if (Arrlist.constructor!=array) {alert (' Smanpromptlist initialization failed: The first parameter is not an array! '); return;} Arrlist.sort (function (A, b) {if (a.length>b.length) return 1; else if (a.length==b.length) return A.localecompare (b); else return-1; } ); } function Smanpromptlist (Arrlist,objinputid) {var Objouter=document.getelementbyid ("__smandisp")//Display Div object var objinput = document.getElementById (Objinputid); Text Box object Var selectedindex=-1; var inttmp; Loop: if (objinput==null) {alert (' Smanpromptlist initialization failed: ' +objinputid+ ' text box not found); The text box loses focus objinput.onblur=function () {objouter.style.display= ' none '; ///text Box button to lift objinput.onkeyup=checkkeycode; The text box gets focus objinput.onfocus=checkandshow; function Checkkeycode () {var ie = (document.all)? True:false if (IE) { var keycode=event.keycode if (keycode==40| | keycode==38) {//next to Var isup=false if (keycode==40) isup=true; Chageselection (ISUP) }else if (keycode==13) {//Carriage return outselection (selectedindex); }else{checkandshow ()}}else{Checkan DShow ()} divposition ()} function Checkandshow () { var strinput = Objinput.value if (strinput!= "") {DIVP Osition (); Selectedindex=-1; objouter.innerhtml = ""; for (inttmp=0;inttmp<arrlist.length;inttmp++) {if (arrlist[inttmp].substr 0, Strinput. Length) ==strinput) {addoption (arrlist[inttmp]); }} objouter.style.display= '; }else{ Objouter.style.display= ' None '; function AddOption (value) {objouter.innerhtml = "<div onmouseover=\" thi S.classname= ' Sman_selectedstyle ' "onmouseout=\" This.classname= ' "onmousedown=\" document.getElementById (' "+ Objinputid+ "'). Value= ' + value + ' ' \ ' > ' + value + ' </div> '}} function Chageselection (isUp) {if (objouter.style.display== ' None ') {Objouter.style . display= '; }else{if (isUp) selectedindex++ Else selectedindex--} var maxindex = objouter.children.length-1; if (selectedindex<0) {selectedindex=0} if (Selectedindex>maxindex) {Selectedindex=maxindex} for (inttmp=0;inttmp<=maxindex;inttmp++) {if (Inttmp==selectedindex) {objouter.children[inttmp].classname= "Sman_selectedstyle"; }else{objouter.children[inttmp].classname= ""; }} function Outselection (Index) {objinput.value = Objouter. Children[index].innertext; Objouter.style.display= ' None '; function divposition () {var clx,cly; Clx=event.clientx; cly = Event.clienty; Objouter.style.top = cly+10; Objouter.style.left = clx+20; Objouter.style.width= getabsolutewidth (Objinput)}} document.write ("<div id= ' __smandisp" Onbul R> </div> "); document.write ("<style>.sman_selectedstyle{background-color: #102681; Color: #FFFFFF}</style>"); function Getabsoluteheight (ob) {return Ob.offsetheight} function Getabsolutewidth (ob) {return ob.offsetwidth} function Getabsolut Eleft (ob) {var mendingleft = ob. offsetleft; while (ob!= null && ob.offsetparent!= null && ob.offsetParent.tagName!= ' body ') {Mendingl EFT = ob. Offsetparent.offsetleft; Mendingob = ob.offsetparent; return mendingleft; function Getabsolutetop (ob) {var mendingtop = ob.offsettop; while (ob!= null && ob.offsetparent!= null && ob.offsetParent.tagName!= ' body ') {Mendingt OP + ob. Offsetparent.offsettop; OB = ob. offsetparent; return mendingtop; } </script> <body onload= "test ()" > Drop-down prompts Follow MOuse walk. Trying to change him into a text box. How to change <input type= "text" id= "aspx" > <input type= "text" id= "aspx2" > <table width= "970" Bor Der= "0" align= "center" > <tr> <td>&Lt;table width= "100%" border= "0" align= "center" > <tr> <td align= "center" valign= "Middle" >&n bsp;</td> </tr> </table> <table border= "1" align= "center" cellspacing= "1" bord Ercolor= "#9CD7FF" id= "table1" > <tr bgcolor= "#99CCFF" > <td bgcolor= "#CEE3FF" >&lt ; font class= "text" > Date </font></td> <td bgcolor= "#FFFFFF" ><input type= "text" id= "Inpute R "></td> </tr> <tr bgcolor=" #99CCFF "> <td bgcolor=" #CEE3FF "> <font class= "Text" > Manufacturing number </font></td> <td bgcolor= "#FFFFFF" ></td> < /tr> <tr bgcolor= "#99CCFF" > <td height= "" bgcolor= "#CEE3FF" ><font class= "text" > Job Content </font></td> <td height= "" "Bgcolor=" #FFFFFF "> </td> </tr > </table> </td> </tr> </table> </body>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.