大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> 罗亭的可输入下拉框的解密简化版.

罗亭的可输入下拉框的解密简化版.

时间: 2021-07-31 作者:daque

即日方才看到罗亭的承诺."请勿做商用".证明:1.罗亭的可输出下拉框是个加密版.(变量名,因变量名都被替代成数字)2.因变量稠密.比方增添简略option等被简化掉了.诸位不妨参考罗亭的贴子.总之,这个要小上一点.看上去也大概会领会点.test.html<html><head><title>compobox</title><meta http-equiv=content-type content="text/html; charset=shift_jis"><!--除外部援用办法--><script type="text/javascript" src="combobox.js"></script></head><body onload="init();"><!-- onresize="resetallsize();"这句话不加好象也不妨.--><form name="form1"><!--即使大概宽窄的话,会有很怪的功效^^--><table border="1" width="395"><tr> <td width="140">input web address:</td> <td width="216"> <select id="combobox1" style="position: absolute; onresize="if (combox1!=null) {combox1.doresize();}" onchange="if (combox1!=null) {combox1.dochange();}" name="select2"><!--这句话里的selected犹如不起效率,大概我没看出来--><option value=www.51js.com selected>www.51js.com</option><option value=www.ccbfu.com>www.ccbfu.com</option><option value=www.sina.com.cn>www.sina.com.cn</option></select>  </td></tr><tr> <td width="140">input web address:</td> <td height="200" width="216"><!--即使要创造多个的话不妨参考这种做法--><select id="combobox2" style="position: absolute" onresize="if (combox2!=null) {combox2.doresize();}" onchange="if (combox2!=null) {combox2.dochange();}" name="select"><option value=www.51js.com selected>www.51js.com</option><option value=www.ccbfu.com>www.ccbfu.com</option><option value=www.sina.com.cn>www.sina.com.cn</option></select> </td></tr><!--提交后不妨看到它是怎样传播值的--><input type="submit" value="submit"><script> var combox1,combox2; function init() {combox1 = new combobox("combobox1", "combox1");combox1.doselectidx(-1); combox2 = new combobox("combobox2", "combox2");combox2.doselectidx(-1); }</script></form></body></html>combobox.jsfunction getleftpostion( theobj ){var pos = 0;while ( theobj != null ){pos += theobj.offsetleft;//get the object which contain theobj.theobj = theobj.offsetparent;}return pos;}function gettoppostion( theobj ){var pos = 0; while ( theobj != null ){pos += theobj.offsettop;//get the object which contain theobj.theobj = theobj.offsetparent;}return pos;}function checkversion(){var isbadversion=true;var curver=navigator.appversion;var pos=parseint(curver.indexof("msie"));if (pos>=1){var intver=parseint(curver.charat(pos+5));if (intver>=5){ isbadversion=false;}}if (isbadversion){var msg="this page may not be displayed properly:\n"+" this product requires microsoft internet explorer 5 or later browser only.";alert(msg); } }//check the browser versioncheckversion();// the array of comboboiesthearray = new array();function combobox(objid, objhandler){this.comobj = document.all[objid]; this.comobj.selectedindex = -1; this.getvalue = getvalue; this.doresize = doresize; this.dochange = dochange; this.losefocus = losefocus; this.doselectidx = doselectidx; this.focus = focus; var strmsg="";//------------------------------------------------------------------------------------------------------// create the text object//------------------------------------------------------------------------------------------------------var txtobjidname = objid + "_text"; if (document.all[txtobjidname] != null){strmsg="the following id: '" + txtobjidname +"' is used internally by the combo box!\r\n"+ "use of this id in your page may cause malfunction. please use another id for your controls.";alert(strmsg);}var txtinner = "<input type='text' id=" + txtobjidname + " name=" + txtobjidname + " onblur='" + objhandler + ".losefocus()' " +  " style='display: none; position: absolute' value='' >";this.comobj.insertadjacenthtml("afterend", txtinner); this.txtobj = document.all[txtobjidname];//------------------------------------------------------------------------------------------------------// end//------------------------------------------------------------------------------------------------------this.beresizing = false; this.doresize(); thearray[thearray.length] = this; }function losefocus(){var thecomobj = this.comobj;var thetxtobj = this.txtobj;var i;thecomobj.selectedindex = -1;if (thetxtobj.value == ""){ return; }var optlen = thecomobj.options.length;for (i=0; i<optlen; i++){var comval = thecomobj.options[i].text;var txtval = thetxtobj.value;if (comval == txtval){ thecomobj.selectedindex = i;return;}}}function doresize(){if (!this.beresizing){this.beresizing = true;this.txtobj.style.display="none";this.comobj.style.position="static";this.txtobj.style.posleft = getleftpostion(this.comobj);this.txtobj.style.postop = gettoppostion(this.comobj) + 1;this.txtobj.style.poswidth = this.comobj.offsetwidth - 16;this.txtobj.style.posheight = this.comobj.offsetheight;this.comobj.style.position ="absolute";this.comobj.style.posleft = this.txtobj.style.posleft;this.comobj.style.postop = this.txtobj.style.postop;this.offwidth = this.comobj.offsetwidth;var strrect = "rect(0 "+(this.comobj.offsetwidth)+" "+ this.comobj.offsetheight +  " "+(this.txtobj.style.poswidth - 2 )+")";this.comobj.style.clip = strrect;this.txtobj.style.display="";this.beresizing = false;}}function dochange(){var idx = this.comobj.selectedindex;var opt = this.comobj.options[idx];this.txtobj.value = opt.text;this.txtobj.focus();this.txtobj.select();this.comobj.selectedindex=-1;}function getvalue(){ return this.txtobj.value; }function doselectidx(i){var optlen = this.comobj.options.length;if ((i >=0) && (i < optlen)){ this.comobj.selectedindex = i;this.txtobj.value = this.comobj.options[i].text;return;}this.txtobj.value = "";}function focus(){ this.txtobj.focus(); }/* resize all combobox when window be resized */function resetallsize(){var i; for (i=0; i < thearray.length; i++){thearray[i].doresize(); } }

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.