document.getElementById为啥不能调用赋值后为啥不能调用?

图片说明

这个是啥原因?
document.getElementById为啥不能调用

3个回答

 getById.call(document,"logo");

logo=getbyid;就可以了。
或者
var getbyid=function(id) { return document.getelementbyid(id); }

devmiao
见了你女王大人喵姐还不跪下 回复zzzcsd: 一个问题采纳了,再问另一个。哪有解决了问题,就把题目编辑掉问新问题的道理,太抠门了吧。
4 年多之前 回复
zzzcsd
zzzcsd 图片发错了,重新看
4 年多之前 回复

这个不能这么调用,,,,

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
一个控件的属性ID,与另一个控件的属性Name重复了。使用document.getElementById(“xxx”)会获取到哪个控件呢?

``` <INPUT id="TextInput" style="width:100"> <INPUT id="TextOutPut" Name="TextInput"> <script type="text/javascript"> document.getElementById("TextOutPut").value =2; document.getElementById("TextInput").value =1; <script> ``` 写代码的时候一个突发奇想,因为输出时需要确认输入源,所以想在触发事件时通过Name属性记录输入源ID,再通过dom操作直接操作对应输入源。 设想这样的结果应该是,textinput=1,textoutput=2。 但实际情况却是textoutput=1,textinput无赋值。 所以想知道一下页面控件中,一个控件的ID与另一个控件的Name重复会有什么情况发生。希望能有大佬普及一下知识。

JS中一个函数里的变量值,怎么可以直接在另外一个函数里用引用

下面是函数中,通过函数计算得到gwp的值并判断绘图。 后面我想把这个计算得到的gwp的值直接在其他函数中调用,应该怎么改 比如gwp改成全局变量,麻烦指导下,有代码就更好 ``` $(function(){ var dom = document.getElementById("box4"); var myChart = echarts.init(dom); var app = {}; option = null; var y_f = []; //全局变量,wgid在gognweizongtu.js中获取 var gwp = 0; var xishu = [0.4,0.2,0.3,0.1]; var pjx = ["gzp","gyp","wlp","ryp"]; var pj = {"gongzhuang":"OK", "gongyi": "OK", "wuliao": "OK", "renyuan": "OK"}; var guige = [90, 90, 80, 75,85]; var xiang = ["gongzhuang","gongyi","wuliao","renyuan"]; for (var i = 0 ; i< xiang.length ; i++) { var lent = data[xiang[i]].y.length ; var ind = lent - 1 ; y_f.push(data[xiang[i]].y[ind]); if (data[xiang[i]].y[ind] < guige[i]){ pj[xiang[i]] = "NOK"; } document.getElementById(pjx[i]).innerHTML = pj[xiang[i]]; gwp += y_f[i]*xishu[i]; } y_f.push(88); if (gwp > 85.5){ document.getElementById("gwpj").innerHTML ="OK"; } gwp = gwp.toFixed(2); document.getElementById("gwp").innerHTML =gwp; document.getElementById("jinri").innerHTML =gwp; document.getElementById("zuori").innerHTML =gwp; document.getElementById("benzhou").innerHTML =gwp; document.getElementById("lishi").innerHTML =gwp; document.getElementById("gwp1").innerHTML =gwp1; /*绘图代码省略*/ }; if (option && typeof option === "object") { myChart.setOption(option, true); } }) ```

请问如何将img的src获取为base64后赋值给一个对象?

我实现了一个上传图片的功能,现在需要获取该图片的base64码赋值给一个对象。 ``` let fileDom = document.getElementById("inputLogo"); let previewDom = document.getElementById("preview"); fileDom.addEventListener("change", e => { let file = fileDom.files[0]; if (!file || file.type.indexOf("image/") < 0) { fileDom.value = ""; previewDom.src = ""; return; } let fileReader = new FileReader(); fileReader.onload = e => { previewDom.src = e.target.result; path = fileReader.result; }; fileReader.readAsDataURL(file); ``` 这里面我通过previewDom.src = e.target.result;获得的src是这样的,可以通过alert打印出来 ![图片说明](https://img-ask.csdn.net/upload/202003/13/1584067906_215119.png) 但通过控制台输出previewDom.src,显示的是 ![图片说明](https://img-ask.csdn.net/upload/202003/13/1584067969_409119.png) 通过path = fileReader.result;我在控制台可以得到base64码 ![图片说明](https://img-ask.csdn.net/upload/202003/13/1584068118_879671.png) 但是alert打印没有效果. 请问一下:这是什么原因? target.result和result得到的值有什么区别? 我的目的是想要的到path这个变量的base64码,赋给一个对象 ``` obj = { header: { //在这里得到img的base64码,赋值给imgLogo imgLogo: path } } ``` 在控制台打印obj.header.imgLogo显示 ![图片说明](https://img-ask.csdn.net/upload/202003/13/1584068595_784509.png) 这应该是没有赋值成功吧? 我想请教一下应该怎么做才能实现把我上传图片的base64码赋值给obj.header.imgLogo里面?

循环调用window.print打印,想只在第一次显示弹窗,后面的弹窗均不显示

使用ajax查询数据,赋值给隐藏的页面,然后调用print()进行打印 不能用插件 ``` var i = 0; function printmore() { var orderRow = $('#dg').datagrid("getSelections"); var len = orderRow.length; if(i == len) { return; } $.ajax({ url : "${pageContext.request.contextPath}/printController/printtransmore?id=" + orderRow[i].id, type : "post", success : function(data) { $("#transNo").html("运单号:" + data.first.transportNo); $("#fromcompany").html( data.first.fromcompanyname + "<br/><br/>" + data.first.fromprovince + data.first.fromcity + data.first.fromarea + data.first.fromcompanyaddress); $("#tocompany").html( data.first.tocompanyname + "<br/><br/>" + data.first.toprovince + data.first.tocity + data.first.toarea + data.first.tocompanyaddress); $("#fromcontact").html( "联系人:" + data.first.fromcompanycontact + "&nbsp;&nbsp;电话:" + data.first.fromcompanyphoneno); $("#tocontact").html( "联系人:" + data.first.tocompanycontact + "&nbsp;&nbsp;电话:" + data.first.tocompanyphoneno); $("#pusername").html(data.trans.pagkageUserName); $("#money").html("运费:"+data.trans.money); $("#insurance").html("其他费用:" + data.trans.insurance); $("#payname").html("付款方式:" + data.trans.payname); for (var a = 0; a < data.list.length; a++) { $("#boxno").html(data.list[a].boxNo); $("#typename").html(data.list[a].typeName); } $("#wcount").html("总重量:" + data.trans.weightCount); $("#bcount").html("总件数:" + data.trans.boxCount+"件"); printit('div1'); i = i + 1; printmore(); } }); } function printit(MyDiv) { //var newstr = document.all.item(myDiv).innerHTML; var newstr = document.getElementById(MyDiv).innerHTML; //alert(newstr); var oldstr = document.body.innerHTML; document.getElementById('printiframe').contentWindow.document.body.innerHTML = newstr; document.getElementById('printiframe').contentWindow.window.print(); document.getElementById('printiframe').contentWindow.document.body.innerHTML = oldstr; } ```

js怎么调用函数中的值

能帮忙指点下这代码应该怎么改,怎么没有结果啊,我就是想在函数中赋值,然后输出调用 ``` <!DOCTYPE html> <html> <body> <h2>JavaScript 函数</h2> <p>本例调用函数把华氏度转换为摄氏度:</p> <p id="gwp1"></p> <script> function () { var gwp=60; var gwp1=gwp+10; document.getElementById("gwp1").innerHTML =gwp1, }, </script> </body> </html> ```

js里只有一类关于name的全局变量取不到值,其他的都可以

这是js代码部分,功能是表单验证 只有变量name、inputName取不到值,其他都可以,查了一天了都没答案,求助 ``` var name = document.getElementById("name"); var psw = document.getElementById("psw"); var confirmation = document.getElementById("confirmation"); var email = document.getElementById("email"); var phone = document.getElementById("phone"); var submit = document.getElementById("submit"); var nameHint = document.getElementById("name-hint"); var pswHint = document.getElementById("psw-hint"); var conHint = document.getElementById("con-hint"); var emailHint = document.getElementById("email-hint"); var phoneHint = document.getElementById("phone-hint"); var inputName,inputPsw,inputConfirmation,inputEmail,inputPhone; function checkNull (text) { var name = document.getElementById("name"); if (text == "") { nameHint.innerHTML = "名称不能为空"; nameHint.style.color = "#de000f"; name.style.border = "solid 1px #de000f"; } else { checkLen(text); } } function checkLen (text) { //\x00-\xff以内的是英文(单字节),以外的是双字节 //匹配不在\x00-\xff范围内的字符 var nchar = /[^\x00-\xff]{1,}/g; var char = /[\w+\S]{1,}/g; //转换成数组 var str = char.exec(text); var nstr = nchar.exec(text); if(str==null){ str=""; } if(nstr==null){ nstr=""; } //转换成字符串 var len = nstr.toString().length*2+str.toString().length; if (3<len && len<17) { nameHint.innerHTML = "名称格式正确"; nameHint.style.color = "#56b73c"; name.style.border = "solid 1px #56b73c"; inputName = true; } else { nameHint.innerHTML = "长度应为4~16个字符"; nameHint.style.color = "#de000f"; name.style.border = "solid 1px #de000f"; } } function checkPsw (text) { if (text == "") { pswHint.innerHTML = "密码不能为空"; pswHint.style.color = "#de000f"; psw.style.border = "solid 1px #de000f"; } else { checkPswLen(psw.value); } } function checkPswLen (text) { //\x00-\xff以内的是英文(单字节),以外的是双字节 //匹配不在\x00-\xff范围内的字符 var nchar = /[^\x00-\xff]{1,}/g; var char = /[\w+\S]{1,}/g; //转换成数组 var str = char.exec(text); var nstr = nchar.exec(text); if(str==null){ str=""; } if(nstr==null){ nstr=""; } //转换成字符串 var len = nstr.toString().length*2+str.toString().length; if (7<len && len<17) { pswHint.innerHTML = "密码可用"; pswHint.style.color = "#56b73c"; psw.style.border = "solid 1px #56b73c"; inputPsw = true; } else { pswHint.innerHTML = "长度应为8~16个字符"; pswHint.style.color = "#de000f"; psw.style.border = "solid 1px #de000f"; } } function checkConfirmation (text) { if (text == "") { conHint.innerHTML = "密码不能为空"; conHint.style.color = "#de000f"; confirmation.style.border = "solid 1px #de000f"; } else if (text == psw.value) { conHint.innerHTML = "密码输入一致"; conHint.style.color = "#56b73c"; confirmation.style.border = "solid 1px #56b73c"; inputConfirmation = true; } else { conHint.innerHTML = "两次密码不一致"; conHint.style.color = "#de000f"; confirmation.style.border = "solid 1px #de000f"; } } function checkEmail (text) { var at = text.indexOf("@"); var dot = text.indexOf("."); if (at < 1 || dot - at < 2) { emailHint.innerHTML = "邮箱格式错误"; emailHint.style.color = "#de000f"; email.style.border = "solid 1px #de000f"; } else { emailHint.innerHTML = "邮箱格式正确"; emailHint.style.color = "#56b73c"; email.style.border = "solid 1px #56b73c"; inputEmail = true; } } function checkPhone (text) { if (!/1[34578]\d{9}/.test(text)) { phoneHint.innerHTML = "手机格式错误"; phoneHint.style.color = "#de000f"; phone.style.border = "solid 1px #de000f"; } else { phoneHint.innerHTML = "手机格式正确"; phoneHint.style.color = "#56b73c"; phone.style.border = "solid 1px #56b73c"; inputPhone = true; } } window.onload = function init () { var name = document.getElementById("name"); name.onfocus = function () { nameHint.innerHTML = "必填,长度为4~16个字符"; nameHint.style.color = "#a9a9a9"; name.style.border = "solid 1px #a9a9a9"; }; name.onblur = function () { checkNull(name.value); }; psw.onfocus = function () { pswHint.innerHTML = "必填,长度为8~16个字符"; pswHint.style.color = "#a9a9a9"; psw.style.border = "solid 1px #a9a9a9"; }; psw.onblur = function () { checkPsw(psw.value); }; confirmation.onfocus = function () { conHint.innerHTML = "再次输入相同密码"; conHint.style.color = "#a9a9a9"; confirmation.style.border = "solid 1px #a9a9a9"; }; confirmation.onblur = function () { checkConfirmation(confirmation.value); }; email.onfocus = function () { emailHint.innerHTML = "输入邮箱"; emailHint.style.color = "#a9a9a9"; email.style.border = "solid 1px #a9a9a9"; }; email.onblur = function () { checkEmail(email.value); }; phone.onfocus = function () { phoneHint.innerHTML = "输入手机"; phoneHint.style.color = "#a9a9a9"; phone.style.border = "solid 1px #a9a9a9"; }; phone.onblur = function () { checkPhone(phone.value); }; submit.onclick = function () { if (inputName&&inputPsw&&inputConfirmation&&inputEmail&&inputEmail) { alert("提交成功!"); } else { if (!inputName) { alert("名称格式错误"); } else if (!inputPsw) { alert("密码格式错误") } else if (!inputConfirmation) { alert("密码输入不一致") } else if (!inputEmail) { alert("email格式错误") } else if (!inputPhone) { alert("手机格式错误") } alert("提交失败!"); } }; }; ```

无法设置未定义或 null 引用的属性"onclick"

``` <div> <asp:button id="btn1" runat="server" OnClick="btn1_click" text="js测试按钮"/> </div> <script type="text/javascript">window.onload = initAll; function initAll() { document.getElementById("btn1").onclick = initRedirect;//该行未取到"btn1",这是为什么???谢谢 function initRedirect() { if (confirm("Are you sure you want to do that?")) { alert("You said yes"); } else { alert("You said no"); } } }</script> ```

js 中addEventListener怎么通过event参数获取绑定者的name或者id

document.getElementById('Button').addEventListener('touchstart',TouchStart,false); 在TouchStart中该怎么知道document.getElementById('Button')的id或name

js XMLHttpRequest.onreadystatechange里怎么把变量设置为全局变量

``` function MeshModel(url,flag) { var CellsNum; var oReq = new XMLHttpRequest(); oReq.open("GET", url, true); oReq.responseType = "arraybuffer"; oReq.send(); oReq.onreadystatechange = function () { if (oReq.readyState == oReq.DONE) { var arrayBuffer = oReq.response; var dataView = new DataView(arrayBuffer); CellsNum = dataView.getInt32(flag,true); //这里可以读出CellsNum 的值 } }; this.getCellsNum = function(){ return CellsNum; }; } function main(){ var url= "http://localhost:8080/Obj/TT.rtd"; var m = new MeshModel(url, 2); document.write(m.getCellsNum()); // 显示undefined } 我想访问CellsNum, 但显示为undefined,应该怎么改进。大神帮帮忙 ```

帮忙看看为何管理那块不显示呢 是在JS文件里的

var ghost = window.location.hostname+":2258"; var sendrefresh = true; var showicon = true; var portraiturl = "http://" + host + "/IceBeans/"; var usenickname = 0; var listmode = 1; function UserList() { this.nSort = 0; this.nSort0 = 0; this.m_pUsers = new Array(); this.GetCount = function () { return this.m_pUsers.length; } this.GetAdminCount = function () { var num = 0; for (var i = 0; i < this.GetCount(); i++) { if (this.GetObject(i).usertype == "11") { num++; } } return num; } this.GetUserCount = function () { return this.m_pUsers.length;// - this.GetAdminCount(); } this.GetObject = function (n) { return this.m_pUsers[n]; } this.GetID = function (strName) { var obj; for (var i = 0; i < this.GetCount(); i++) { if (this.GetObject(i).name == strName) { obj = this.GetObject(i); return obj.id; } } return 0; } this.Find = function (strName) { for (var i = 0; i < this.GetCount(); i++) if (this.GetObject(i).name == strName) return i; return -1; } this.FindObject = function (strName) { var i = this.Find(strName); if (i != -1) return this.GetObject(i); return null; } this.FindbyID = function (ID) { for (var i = 0; i < this.GetCount(); i++) if (this.GetObject(i).id == ID) return i; return -1; } this.FindObjectbyID = function (ID) { var i = this.FindbyID(ID); if (i != -1) return this.GetObject(i); return null; } this.Add = function (name, adminmode, usertype, extinfo, icon, id, sex, voice, video) { var obj, n; if ((n = this.Find(name)) != -1) obj = this.GetObject(n); else obj = new UserObject(); obj.name = name; obj.adminmode = adminmode; obj.usertype = usertype; obj.extinfo = extinfo; obj.icon = icon; obj.id = id; obj.sex = sex; obj.voice = voice; obj.video = video; obj.level = get_user_type(name); if (n == -1) this.m_pUsers[this.GetCount()] = obj; this.DoSort(); } this.Del = function (strName) { var n = this.Find(strName); if (n != -1) { delete this.m_pUsers[n]; this.m_pUsers.sort(this.SortOnNull); this.m_pUsers.length--; return true; } return false; } this.RemoveAll = function () { for (var i = 0; i < this.GetCount(); i++) delete this.m_pUsers[i]; this.m_pUsers.length = 0; } this.SortOnXB = function (a, b) { var n1 = a.sex; var n2 = b.sex; if (n1 == n2) return 0; if (n1 > n2) return 1; if (n1 < n2) return -1; } this.SortOnName = function (a, b) { var n1 = a.name.length; var n2 = b.name.length; if (n1 == n2) return 0; if (n1 > n2) return -1; if (n1 < n2) return 1; } this.SortOnName1 = function (a, b) { var a2 = new String(a.name); var b2 = new String(b.name); if (a.adminmode == 1 && b.adminmode != 1) { t = -1; } else if (a.adminmode != 1 && b.adminmode == 1) { t = 1; } else { if (a2.substr(0, 1) == "*" && b2.substr(0, 1) != "*") { t = -1; } else if (a2.substr(0, 1) != "*" && b2.substr(0, 1) == "*") { t = 1; } else { if (a2 == b2) { t = 0; } if (a2 > b2) { t = -1; } if (a2 < b2) { t = 1; } } } return t; } this.SortOnName2 = function (a, b) { if (a.adminmode == 1 && b.adminmode != 1) { t = -1; } else if (a.adminmode != 1 && b.adminmode == 1) { t = 1; } else { t = 0; } return t; } this.SortOnUserType = function (a, b) { if (a.adminmode == 1 && b.adminmode != 1) { t = -1; } else if (a.adminmode != 1 && b.adminmode == 1) { t = 1; } else { if (a.usertype > b.usertype) { t = 1; } else if (a.usertype < b.usertype) { t = -1; } else { if (a.name < b.name) { t = 1; } else if (a.name > b.name) { t = -1; } else { t = 0; } } } return t; } this.SortOnNull = function (a, b) { if (a == null || b == null) return -1; return 0; } this.DoSort = function () { return; } this.SortByLevel = function () { this.m_pUsers.sort(function (a, b) { return a.level - b.level; }); } } var timerID = null, timerRunning = false; function refreshstop() { if (timerRunning) clearTimeout(timerID); timerRunning = false; } function refreshstart() { refreshstop(); writeuserlist(); } function Users_Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) { var isnewuser = (parent.Users.FindObject(name) == null); try { this.d.refreshsdx(name, id); } catch (e) { } if (limituserlist == 1) { if ((voice == 0) && (video == 0)) { newlogin(name, id, nickname); } if (usertype != "11") { //如果是管理员保证列出。可以在脚本中重定义本函数使得VIP用户也可以保证列出 if (this.Users.GetCount() > limituserlistnum) { return; } } } this.Users.Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname); if (this.Users.GetCount() < refreshatonce_threshold) { refreshstart(); } if (listmode == 1) { if (list_parsed == 0) { var tmp = name + "-'" + adminmode + "-'" + usertype + "-'" + extinfo + "-'" + icon + "-'" + id + "-'" + exps + "-'" + nickname + "'-" + sex + "'-" + voice + "'-" + video; list.push(tmp); list_length = list.length; } else { addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname); } } if (isAutoWelcome && isnewuser) { if (get_user_type(name) > 10) { setTimeout('parent.d.send_msg_ex("' + name + '","[Advertising][username=' + parent.myinfo.USER + ']","",1,11,"",1)', 15000); } } } function Users_Add1(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) { if (limituserlist == 1) { if ((voice == 0) && (video == 0)) { newlogin(name, id, nickname); } if (usertype != "11") { //如果是管理员保证列出。可以在脚本中重定义本函数使得VIP用户也可以保证列出 if (this.Users.GetCount() > limituserlistnum) { return; } } } this.Users.Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname); this.Users.SortByLevel(); if (this.Users.GetCount() < refreshatonce_threshold) { //refreshstart(); } /*增加到用户列表*/ if (listmode == 1) { addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname); } } function newlogin(name, id, nickname) { if (this.n == null) return; if (this.n.document == null) return; var objTable = this.n.document.getElementById('newuserlisttable'); var row = objTable.rows.length; var i = 0; for (i = 1; i < row; i++) { if (objTable.rows[i].id == id) { return; } } if (objTable.rows.length >= 6) { objTable.deleteRow(1); } var objRow = objTable.insertRow(); objRow.id = id; var objCell = objRow.insertCell(); if (usenickname) { objCell.innerHTML = "[<a target=d href=\"javascript:parent.cs('" + name + "'," + id + ")\">" + nickname + "</a>]"; } else { objCell.innerHTML = "[<a target=d href=\"javascript:parent.cs('" + name + "'," + id + ")\">" + name + "</a>]"; } } function Users_Del(str) { if (this.Users.Del(str)) if (this.Users.GetCount() < refreshatonce_threshold) { refreshstart(); } if (listmode == 1) { deluserfromlist(str); } } function Users_GetID(str) { return this.Users.GetID(str); } var Users = new UserList(); function dodeluserfromlist(listtable, name) { var i; var rown = 0; rown = listtable.rows.length; for (i = 0; i < rown; i++) { if (listtable.rows[i].id == name) { listtable.deleteRow(i); return 1; break; } } return 0; } function smdeluser(listtable,name) { var table = this.r.document.getElementById(""+listtable+""); dodeluserfromlist(table, name); this.r.document.getElementById("AdminCount").innerHTML = this.r.document.getElementById("AdminCount").innerHTML-1; } function checkvipuser(name) { return "Z"; } function getlist(type) { if (type != "adm") return; alist = new Array(); listtable = this.r.document.getElementById("listtable_" + type); rown = listtable.rows.length; for (i = 0; i < rown; i++) { alist[alist.length] = listtable.rows[i].id; } } function Swap(table, i, j) { if (i < 0 || j > table.rows.length - 1) return; if (i < j) { table.moveRow(i, j); table.moveRow(j - 1, i); } else { table.moveRow(i, j); table.moveRow(j + 1, i); } } function addusertolist(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname) { if (this.r == null) return; if (this.r.document == null) return; if (list_parsed == 1) { //this.r.document.getElementById("usercount").innerHTML = Users.GetCount(); this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount(); this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount(); } if (ppmode == 1) { voice = 1; } var i; var listtable, listrow, listcell; var rown = 0; if (adminmode == 0) { //remove from listtable_adm /*下管情况需删除管理员里相同名字*/ listtable = this.r.document.getElementById("listtable_adm"); dodeluserfromlist(listtable, name); } /*取相关列表表格*/ level = get_user_type(name); portrait = ""; //icon = ""; displayname = new String(name); if (extinfo != 0) t = extinfo; else t = ""; var infolist = new Array(""); if (typeof (t) != "undefined" && t != "" && displayname.substr(0, 1) == "*") { infolist = t.split(":"); if (!infolist[0]) { infolist[0] = "" }; if (!infolist[1]) { infolist[1] = "" }; if (!infolist[2]) { infolist[2] = "" }; portrait = infolist[0]; //icon = infolist[1]; } userinfo0 = getptid(name, portrait, adminmode) userinfo = userinfo0.split("\t"); styletext = "" title = ""; adminmode_ret = adminmode; if (userinfo.length >= 1) { ptid = userinfo[0]; if (userinfo.length >= 2) { styletext = userinfo[1]; if (userinfo.length >= 3) { title = userinfo[2]; if (userinfo.length >= 4) { adminmode_ret = userinfo[3]; } } } } else { ptid = userinfo0; } if (usertype == "11") { listtable = this.r.document.getElementById("listtable_sm"); } else if (level > 0 ) { listtable = this.r.document.getElementById("listtable_vip"); } else if (name.charAt(0) == '*' ) { listtable = this.r.document.getElementById("listtable_reg"); } else { listtable = this.r.document.getElementById("listtable_other"); } rown = listtable.rows.length; listrow = null; /*按级别和昵称字符排序*/ for (i = 0; i < rown; i++) { cmpname = listtable.rows[i].id; cmplevel = listtable.rows[i].level; cmpstr = cmplevel + cmpname; if (cmpstr == level + name) { listrow = listtable.rows[i]; } } // var p_length = listtable.rows.length; // for (var i = 0; i <= p_length - 2; i++) { // for (var j = p_length - 1; j >= 1; j--) { // if (listtable.rows[j].level < listtable.rows[j - 1].level) { // Swap(listtable, j, j - 1); // } // } // } if (listrow == null) { /*没有此名的*/ /*上管情况下需从其他列表表格中删除同名者,*/ if (adminmode > 0) { var listtable1; listtable1 = this.r.document.getElementById("listtable_vip"); if (dodeluserfromlist(listtable1, name) == 0) { listtable1 = this.r.document.getElementById("listtable_reg"); if (dodeluserfromlist(listtable1, name) == 0) { listtable1 = this.r.document.getElementById("listtable_other"); dodeluserfromlist(listtable1, name); } } } /*增加进相关列表表格*/ listrow = listtable.insertRow(i); listrow.id = name; listrow.level = level; } else { /*有此名的,先删除该行第一列(声频视频状态可能变化,需要重写)*/ listrow.deleteCell(0); } /*重写该行第一列*/ listcell = listrow.insertCell(0); var cellcontent = ""; if (showicon == true) { //portrait = "<image src=" + ptid + ".gif border=0 align=absmiddle>"; var s = sex == 0 ? "0" : "1"; s = "1"; var imgurl = myvip.GetImgUrl(name, s); portrait = "<image src='" + imgurl + "' border='0' align='absmiddle'>"; //portrait += "<img src='" + "http://m.ABC.COM/xq/" + icon + "_x.gif" + "' border='0' align='absmiddle'>"; } else { portrait = ""; } if (voice == 1) { voicenote = "<font face=\"Webdings\" color=000000>&#175</font>"; nametitle = name + " 开麦"; } else if (voice == 2) { voicenote = "<font face=\"Wingdings\" color=black>(</font>"; nametitle = name + " 双工"; } else { voicenote = ""; nametitle = name + " 关麦"; } if (adminmode_ret == 1) { nametitle += " 在线管理员"; } if (title != "") { nametitle += " " + title; } if (nametitle != "") nametitle = " title=\"" + nametitle + "\""; if (adminmode_ret == 1) { if (styletext == "") { styletext = "color:red;"; displayname += "<font color=red></font>"; } else { displayname += "*"; } } if (styletext == "0") styletext = ""; var ucolor = usercolor.FindObject(name); var xc = is_uservip(name); if (xc != null) { var v = xc.split(","); //displayname += "<img src=http://www.ABC.COM/user/xc2/" + v[5] + " border=0 hspace=1 vspace=1 align='absmiddle' /> "; //displayname = "<a target=d href=\"javascript:parent.cs('" + name + "')\"title=\"" + v[6] + "\">"; if (v[0] == '1') { displayname = "<img src=http://www.ABC.COM/user/xc1/" + v[1] + " border=0><font style=\"filter: glow(color=#9933FF,strength=4); Height:8pt; color:#FFFFFF; padding:1px;cursor:hand\">" + v[7] + "</font>" } else { displayname = "<font style=\"filter: glow(color=#" + v[2] + ",strength=4); Height:8pt; color:#" + v[3] + "; padding:1px;cursor:hand\">" + v[4] + "</font><font style=\"filter: glow(color=#9933FF,strength=4); Height:8pt; color:#FFFFFF; padding:1px;cursor:hand\">" + v[7] + "</font>"; } } else if (ucolor != null) { if (styletext) { displayname = "<span style='filter: glow(color=" + ucolor.outcolor + ",strength=4); PADDING-BOTTOM: 1px; padding-left: 1px; padding-right: 1px; height: 8pt; color: red; cursor: hand; padding-top: 1px;'>" + displayname + "</span>"; } else { displayname = "<span style='filter: glow(color=" + ucolor.outcolor + ",strength=4); PADDING-BOTTOM: 1px; padding-left: 1px; padding-right: 1px; height: 8pt; color: " + ucolor.incolor + "; cursor: hand; padding-top: 1px;'>" + displayname + "</span>"; } } else if (styletext) { displayname = "<span style='" + styletext + "'>" + displayname + "</span>"; } cellcontent += portrait + "&nbsp;<a class='name' target=d href=\"javascript:parent.cs('" + name + "')\" " + nametitle + ">" + displayname + "</a>"; cellcontent += voicenote; if (video == 1) { cellcontent += "<img src='" + portraiturl + "images/shipin.gif' border='0' width='20' height='20' align='absmiddle'>"; } var twgif=""; if ((level >= 13 && level <= 15) && video == 1) { cellcontent += "<span class='PrivateMike'><a href=\"javascript:parent.watch_name('" + name + "')\"><img src='" + portraiturl + "images/simai.gif' width='20' height='20' padding-left='10px;'></a></span>"; cellcontent += "<span class='PrivateMikeS'><a href='http://pay.ABC.COM' target='_blank' ><img src='" + portraiturl + "images/s.gif' width='20' height='20'></a></span>"; twgif = "<img src='"+portraiturl+"images/tw.gif' border='0' alt='' title=''/>"; } listcell.innerHTML = "<span class='ydt'></span>" + twgif + cellcontent; } function deluserfromlist(name) { if (this.r == null) return; if (this.r.document == null) return; if (list_parsed == 1) { //this.r.document.getElementById("usercount").innerHTML = Users.GetCount(); this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount(); this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount(); } var listtable; listtable = this.r.document.getElementById("listtable_adm"); if (dodeluserfromlist(listtable, name) > 0) return; listtable = this.r.document.getElementById("listtable_vip"); if (dodeluserfromlist(listtable, name) > 0) return; listtable = this.r.document.getElementById("listtable_reg"); if (dodeluserfromlist(listtable, name) > 0) return; listtable = this.r.document.getElementById("listtable_other"); if (dodeluserfromlist(listtable, name) > 0) return; return; } function removealluserfromlist() { if (this.r == null) return; if (this.r.document == null) return; if (list_parsed == 1) { //this.r.document.getElementById("usercount").innerHTML = Users.GetCount(); this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount(); this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount(); } var i; var listtable; var rown = 0; listtable = this.r.document.getElementById("listtable_adm"); rown = listtable.rows.length; for (i = rown - 1; i >= 0; i--) { listtable.deleteRow(i); } listtable = this.r.document.getElementById("listtable_vip"); rown = listtable.rows.length; for (i = rown - 1; i >= 0; i--) { listtable.deleteRow(i); } listtable = this.r.document.getElementById("listtable_reg"); rown = listtable.rows.length; for (i = rown - 1; i >= 0; i--) { listtable.deleteRow(i); } listtable = this.r.document.getElementById("listtable_other"); rown = listtable.rows.length; for (i = rown - 1; i >= 0; i--) { listtable.deleteRow(i); } } /* 由setInterval循环调用本函数初始用户数组list(按先后顺序)赋值至Users,利用list_parsing标识避免冲突 */ function dolistparse() { if (list_parsing) { return; } list_parsing = 1; list_i++; var i = list_i; if (i < list_length) { if (list[i] != null) { sublists = list[i].split("'-"); if (sublists.length == 4) { if (!sublists[1]) sublists[1] = ''; if (!sublists[2]) sublists[2] = ''; if (!sublists[3]) sublists[3] = ''; sex = sublists[1]; voice = sublists[2]; if (ppmode == 1) { voice = 1; } video = sublists[3]; } else { if (!sublists[1]) sublists[1] = ''; if (!sublists[2]) sublists[2] = ''; voice = sublists[1]; if (ppmode == 1) { voice = 1; } video = sublists[2]; sex = 0; } lists = sublists[0].split("-'"); if (!lists[1]) lists[1] = ''; if (!lists[2]) lists[2] = ''; if (!lists[3]) lists[3] = ''; if (!lists[4]) lists[4] = ''; if (!lists[5]) lists[5] = ''; if (!lists[6]) lists[6] = '0'; if (!lists[7]) lists[7] = ''; name = lists[0]; adminmode = lists[1]; usertype = lists[2]; extinfo = lists[3]; icon = lists[4]; id = lists[5]; exps = lists[6]; nickname = lists[7]; Users_Add1(name, adminmode, usertype, extinfo, icon, id, sex, voice, video, exps, nickname); } } else { clearInterval(list_timer); list_parsed = 1; //this.r.document.getElementById("usercount").innerHTML = Users.GetCount(); this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount(); this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount(); } list_parsing = 0; } function RefreshUsers() { if (listmode == 1) { list_parsed = 0; list_i = 0; list_length = 0; list_parsing = 0; list_length = list.length; Users.RemoveAll(); removealluserfromlist(); list_timer = setInterval("dolistparse()", 1); if ((this.r != null) && (this.r.document != null)) { //this.r.document.getElementById("usercount").innerHTML = this.usercount; this.r.document.getElementById("AdminCount").innerHTML = Users.GetAdminCount(); this.r.document.getElementById("UserCount").innerHTML = Users.GetUserCount(); } return; } Users.RemoveAll(); for (var i = 1; i < list.length; i++) if (list[i] != null) { sublists = list[i].split("'-"); if (sublists.length == 4) { if (!sublists[1]) sublists[1] = ''; if (!sublists[2]) sublists[2] = ''; if (!sublists[3]) sublists[3] = ''; sex = sublists[1]; voice = sublists[2]; video = sublists[3]; } else { if (!sublists[1]) sublists[1] = ''; if (!sublists[2]) sublists[2] = ''; voice = sublists[1]; video = sublists[2]; sex = 0; } lists = sublists[0].split("-'"); if (!lists[1]) lists[1] = ''; if (!lists[2]) lists[2] = ''; if (!lists[3]) lists[3] = ''; if (!lists[4]) lists[4] = ''; if (!lists[5]) lists[5] = ''; name = lists[0]; adminmode = lists[1]; usertype = lists[2]; extinfo = lists[3]; icon = lists[4]; id = lists[5]; Users_Add(name, adminmode, usertype, extinfo, icon, id, sex, voice, video); } refreshclick = true; writeuserlist(); } function writerframe() { if (listmode == 0) { return; } if (this.r == null) return; if (this.r.document == null) return; this.r.document.open(); this.r.document.writeln("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); this.r.document.writeln("<link rel='stylesheet' href='"+portraiturl+"css/right.css' type='text/css' />"); this.r.document.writeln("</head><body style='background-color: transparent;'>"); this.r.document.writeln(" <script type=\"text/javascript\">"); this.r.document.writeln(" function openShutManager(oSourceObj, oTargetObj, shutAble, oOpenTip, oShutTip) {"); this.r.document.writeln(" var sourceObj = typeof oSourceObj == \"string\" ? document.getElementById(oSourceObj) : oSourceObj;"); this.r.document.writeln(" var targetObj = typeof oTargetObj == \"string\" ? document.getElementById(oTargetObj) : oTargetObj;"); this.r.document.writeln(" var openTip = oOpenTip || \"\";"); this.r.document.writeln(" var shutTip = oShutTip || \"\";"); this.r.document.writeln(" if (targetObj.style.display != \"none\") {"); this.r.document.writeln(" if (shutAble) return;"); this.r.document.writeln(" targetObj.style.display = \"none\";"); this.r.document.writeln(" if (openTip && shutTip) {"); this.r.document.writeln(" sourceObj.innerHTML = shutTip;"); this.r.document.writeln(" }"); this.r.document.writeln(" } else {"); this.r.document.writeln(" targetObj.style.display = \"block\";"); this.r.document.writeln(" if (openTip && shutTip) {"); this.r.document.writeln(" sourceObj.innerHTML = openTip;"); this.r.document.writeln(" }"); this.r.document.writeln(" }"); this.r.document.writeln(" }"); this.r.document.writeln(" function setTab(name, cursel, n) {"); this.r.document.writeln(" for (i = 1; i <= n; i++) {"); this.r.document.writeln(" var menu = document.getElementById(name + i);"); this.r.document.writeln(" var con = document.getElementById(\"con_\" + name + \"_\" + i);"); this.r.document.writeln(" menu.className = i == cursel ? \"hover\" : \"\";"); this.r.document.writeln(" con.style.display = i == cursel ? \"block\" : \"none\";"); this.r.document.writeln(" }"); this.r.document.writeln(" }"); this.r.document.writeln(" <\/script>"); this.r.document.writeln(" <div class=\"Tab1\">"); this.r.document.writeln(" <div class=\"Menubox\">"); this.r.document.writeln(" <ul>"); this.r.document.writeln(" <li id=\"one1\" onmousemove=\"setTab(\'one\',1,2)\" class=\"hover\" style=\"margin-right: 1px;\">"); this.r.document.writeln(" 用户/<span id=\"UserCount\">0</span></li>"); this.r.document.writeln(" <li id=\"one2\" onmousemove=\"setTab(\'one\',2,2)\" class=\"\">管理/<span id=\"AdminCount\">0</span></li>"); this.r.document.writeln(" <li style=\"background: none; width: 10px; padding-left: 4px;\"><a href=\"#\" onclick=\"openShutManager(this,\'box\')\">"); this.r.document.writeln(" <img src=\"" + portraiturl + "images/rig04.gif\"></a></li>"); this.r.document.writeln(" <li style=\"background: none; width: 10px; padding-left: 4px;\">"); this.r.document.writeln(" <img src=\"" + portraiturl + "images/rig05.gif\"></li>"); this.r.document.writeln(" </ul>"); this.r.document.writeln(" </div>"); this.r.document.writeln(" <div id=\"box\" style=\"display: none\" class=\"rig01\">"); this.r.document.writeln(" <div style=\"float: left\">"); this.r.document.writeln(" <img src=\"" + portraiturl + "images/rig07.gif\"></div>"); this.r.document.writeln(" <div class=\"rig03\">"); this.r.document.writeln(" <input type=\"text\" style=\"color: #999999; background: transparent; border: none\""); this.r.document.writeln(" onfocus=\"if(value==defaultValue){value=\'\';this.style.color=\'#000\'}\" onblur=\"if(!value){value=defaultValue;this.style.color=\'#999\'}\""); this.r.document.writeln(" value=\"请输入房间名\" size=\"17\"></div>"); this.r.document.writeln(" <div style=\"float: left; padding-left: 3px; padding-top: 3px;\">"); this.r.document.writeln(" <a href=\"#\">邀请好友</a></div>"); this.r.document.writeln(" </div>"); this.r.document.writeln(" <div class=\"Contentbox\">"); this.r.document.writeln(" <div id=\"con_one_1\" style=\"display: block;\">"); this.r.document.writeln(" <table class=\'list\' width=\"100%\" border=\"0\" id=\"listtable_adm\" cellspacing=\"5\">"); this.r.document.writeln(" </table>"); this.r.document.writeln(" <table class=\'list\' width=\"100%\" border=\"0\" id=\"listtable_vip\" cellspacing=\"5\">"); this.r.document.writeln(" </table>"); this.r.document.writeln(" <table class=\'list\' width=\"100%\" border=\"0\" id=\"listtable_reg\" cellspacing=\"5\">"); this.r.document.writeln(" </table>"); this.r.document.writeln(" <table class=\'list\' width=\"100%\" border=\"0\" id=\"listtable_other\" cellspacing=\"5\">"); this.r.document.writeln(" </table>"); this.r.document.writeln(" </div>"); this.r.document.writeln(" <div id=\"con_one_2\" style=\"display: none;\">"); this.r.document.writeln(" <table class=\'list\' width=\"100%\" border=\"0\" id=\"listtable_adm\" cellspacing=\"5\">"); this.r.document.writeln(" </table>"); this.r.document.writeln(" </div>"); this.r.document.writeln(" </div>"); this.r.document.writeln(" </div>"); this.r.document.writeln("</body></html>"); this.r.document.writeln("<script type=\"text/javascript\">"); this.r.document.writeln(" setTimeout('parent.BindListMenu();',5000);"); this.r.document.writeln("<\/script>"); this.r.document.close(); } writerframe(); function writeuserlist() { if (listmode == 1) { return; } if (sendrefresh == false) { sendrefresh = true; } else { var count = Users.GetCount(); if ((count < autorefresh_threshold) || (autorefreshuserlist == true) || (refreshclick == true) && (listshow == 0)) { // for (var i = 0; i < list.length; i++) { // delete list[i]; // } list = new Array(); list[0] = ""; for (i = 0; i < count; i++) { //name-'adminmode-'usertype-'extinfo-'icon'-sex'-voice'-video obj = Users.GetObject(i); tmp = obj.name + "-'" + obj.adminmode + "-'" + obj.usertype + "-'" + obj.extinfo + "-'" + obj.icon + "'-" + obj.voice + "'-" + obj.video list[i + 1] = tmp; } //list.sort(); if (this.d.loaded == 1) write(); if (refreshclick == true) { refreshclick = false; } } } timerRunning = true; timerID = setTimeout("refreshstart()", nTimer * 1000); } function sortuser() { user_sorted = new Array(); for (var i = 1; i < list.length; i++) { if (list[i] != "") { var lists_split = list[i].split("'-"); if (!lists_split[1]) lists_split[1] = '0'; if (!lists_split[2]) lists_split[2] = '0'; var lists_split_2 = lists_split[0].split("-'"); if (lists_split_2[1] != '1') lists_split_2[1] = '2'; if (lists_split_2[0].substr(0, 1) == "*") { usertype = "0"; } else { usertype = "1"; } userinfo = ""; user_str = lists_split_2[1]; user_str += "&"; user_str += usertype; user_str += "&"; user_str += userinfo; user_str += "&"; user_str += lists_split_2[0]; user_str += "&"; user_str += lists_split[1]; user_str += "&"; user_str += lists_split[2]; user_str += "&"; user_str += lists_split_2[3]; user_sorted[user_sorted.length] = user_str; } } user_sorted.sort(); } function writerframes() { if (listmode == 1) { return; } sortuser(); count = user_sorted.length; if (this.r.document == null) return; this.r.document.open(); this.r.document.writeln("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); this.r.document.writeln("<style type=text/css>"); this.r.document.writeln("<!--"); this.r.document.writeln(".p9 { font-size: 9pt}"); this.r.document.writeln("body { font-size: 9pt; margin:0; padding:0; width:175px; overflow-x:hidden}"); this.r.document.writeln("td { font-size: 9pt}"); this.r.document.writeln("a { color: #0000FF; text-decoration: none}"); this.r.document.writeln("#bl_yh_lb{margin:0 0 0 3px; padding:0;width:175px;}"); this.r.document.writeln("#bl_yh_lb li{line-height:21px; height:21px; list-style-type:none; margin:0; padding:2px 0;}"); this.r.document.writeln("-->"); this.r.document.writeln("</style>"); this.r.document.writeln("<div id=\"Tips\" style=\"position:absolute; left:0; top:0; width:130; display=none; z-index:2\">"); this.r.document.writeln(" <p class=\"\">&nbsp;</p>"); this.r.document.writeln("</div>"); this.r.document.writeln("</head><body bgcolor=\"#F3FFE1\" leftMargin=0>"); this.r.document.writeln("<div align=center id=\"topbanner\"><image src=http://" + host + "/bl/$E/upload/tb.gif border=0><br><font color=#FF0000><marquee width=140 scrolldelay=200>您好!欢迎您光临《$$title》网址:http://$E.abc.com</marquee></font></div>"); this.r.document.writeln("<div id=\"chatbody\" class=\"p9\"><div style=\"margin:3px; border-bottom:1px dashed #666666; \"> <a style=\"float:right;\" accesskey=\"n\" href=\"javascript:\" onclick=\"parent.d.document.getElementById('REFRESHUSERLIST').click()\"><img src=\"" + portraiturl + "chattools/refresh.png\" alt=\"刷新在线列表\" border=0 align=\"absmiddle\"></a>"); this.r.document.writeln("<a style=\"float:right; margin:0 5px;\" accesskey=r href=\"javascript:parent.cs('所有人')\"><img src=\"" + portraiturl + "chattools/all.png\" alt=\"所有人\" border=0 align=\"absmiddle\"></a><img src=\"" + portraiturl + "chattools/online.png\" alt=\"在线人数\" align=\"absmiddle\"><font color=red>" + count + "</font></div>"); this.r.document.writeln("<ul id=\"bl_yh_lb\">"); //alist=new Array(); for (var i = 0; i < count; i++) { this.r.document.writeln("<li>"); var displayname; thislists = user_sorted[i].split("&"); thisadminmode = thislists[0]; thistype = thislists[1]; thisinfo = thislists[2]; thisname = thislists[3]; thisvoice = thislists[4]; thisvideo = thislists[5]; thisextinfo = thislists[6]; thisex = ""; if (thisadminmode != "1") thisadminmode = "0"; displayname = new String(thisname); myportrait = ""; myicon = ""; if (thisextinfo != 0) t = thisextinfo; else t = ""; var infolist = new Array(""); if (t != "" && displayname.substr(0, 1) == "*") { infolist = t.split(":"); if (!infolist[0]) { infolist[0] = "" }; if (!infolist[1]) { infolist[1] = "" }; if (!infolist[2]) { infolist[2] = "" }; myportrait = infolist[0]; myicon = infolist[1]; } userinfo0 = getptid(thisname, myportrait, thisadminmode) userinfo = userinfo0.split("\t"); styletext = "" title = ""; adminmode_ret = thisadminmode; if (userinfo.length >= 1) { ptid = userinfo[0]; if (userinfo.length >= 2) { styletext = userinfo[1]; if (userinfo.length >= 3) { title = userinfo[2]; if (userinfo.length >= 4) { adminmode_ret = userinfo[3]; if (userinfo.length == 5) { title = userinfo[4]; } } } } } else { ptid = userinfo0; } if (showicon == true) { portrait = "<image src=" + ptid + ".gif border=0 align=absmiddle>"; } else portrait = ""; if (thisvoice == 1) { voicenote = "<font face=\"Wingdings\" color=#009900>(</font>"; nametitle = thisname + " 开麦"; } else if (thisvoice == 2) { voicenote = "<font face=\"Wingdings\" color=black>(</font>"; nametitle = thisname + " 双工"; } else { voicenote = ""; nametitle = thisname + " 关麦"; } if (adminmode_ret == 1) { nametitle += " 在线管理员"; } if (title != "") { nametitle += " " + title; } if (nametitle != "") nametitle = " title=\"" + nametitle + "\""; if (adminmode_ret == 1) { //alist[alist.length]=thisname; if (styletext == "") { styletext = "color:red;"; displayname += "<font color=red>*</font>"; } else { displayname += "*"; } } if (styletext == "0") styletext = ""; if (styletext) { displayname = "<span style='" + styletext + "'>" + displayname + "</span>"; } this.r.document.writeln(portrait + "<a target=d href=\"javascript:parent.cs('" + thisname + "')\" " + nametitle + ">" + displayname + "</a>"); this.r.document.writeln(voicenote); if (thisvideo == 1) { this.r.document.writeln("<font face=\"Webdings\" color=000000>N</font>"); } this.r.document.writeln("</li>"); } this.r.document.writeln("</ul>"); this.r.document.writeln("</div><div align=center id='bottombanner' style='border:0px solid #000000;padding:0;POSITION: relative; Left: 0px; TOP: 0px; HEIGHT: 40px; WIDTH: 130px;'></div>"); this.r.document.writeln('</body></html>'); this.r.document.close(); } ////////////// function getptid(username, portrait, adminmode) { style = ""; return portraiturl + portrait + "\t" + style; } var ListTable = ["listtable_adm", "listtable_vip", "listtable_reg", "listtable_other"]; var ListUserCount = 0; var Order = false; window.setInterval(function () { var num = Users.GetCount(); if (num - ListUserCount < 30 && ListUserCount - num < 30 && !Order) { for (var s = 0; s < ListTable.length; s++) { var listtable = this.r.document.getElementById(ListTable[s]); var p_length = listtable.rows.length; for (var i = 0; i <= p_length - 2; i++) { for (var j = p_length - 1; j >= 1; j--) { if (listtable.rows[j].level < listtable.rows[j - 1].level) { Swap(listtable, j, j - 1); } } } } Order = true; } else if (ListUserCount != num) { Order = false; ListUserCount = num; } }, 3000); parent.refreshstop = refreshstop; parent.refreshstart = refreshstart; parent.Users_Add = Users_Add; parent.Users_Add1 = Users_Add1; parent.newlogin = newlogin; parent.Users_Del = Users_Del; parent.Users_GetID = Users_GetID; var Users = new UserList(); parent.dodeluserfromlist = dodeluserfromlist; parent.checkvipuser = checkvipuser; parent.getlist = getlist; parent.addusertolist = addusertolist; parent.deluserfromlist = deluserfromlist; parent.removealluserfromlist = removealluserfromlist; parent.dolistparse = dolistparse; parent.RefreshUsers = RefreshUsers; parent.writerframe = writerframe; parent.writeuserlist = writeuserlist; parent.sortuser = sortuser; parent.write = write; parent.getptid = getptid; function showElement(elementId) { document.getElementById(elementId).style.display = "block"; } function hideElement(elementId) { document.getElementById(elementId).style.display = "none"; }

Python selenium,无法定位页面中的日期选择框,尝试用JS关掉只读失败?

0、这是需要定位的位置: ``` <input class="form-control listDate startDate" readonly="readonly" name="startDate" value="" type="text"> ``` 1、Python selenium,无法定位页面中的日期选择框,面向百度编程后发现可能是句柄的位置不对,于是加上了 ``` el_iframe=el_ywjg=browser.find_element_by_id('frame_content') browser.switch_to.frame('frame_content') ``` 2、仍然定位不到日期选择框,继续搜索后觉得可能是因为“readonly”属性,于是决定使用js去掉,但是这个框没有Id,于是换用getElementsByName(半路出家,完全不懂js,不知道对不对),于是变成了 ``` js="document.getElementsByName('startDate').removeAttribute('readonly')" browser.execute_script(js) ``` _报错:TypeError: document.getElementsByName(...).removeAttribute is not a function 3、查菜鸟教程发现“HTML DOM Document 对象方法”中,document.getElementById()返回的是一个对象,而我用的getElementsByName()返回的是一个对象集合,所以加上了一个[0],变成: ``` js="document.getElementsByName('startDate')[0].removeAttribute('readonly')" browser.execute_script(js) ```__ _TypeError: document.getElementsByName(...)[0] is undefined 无计可施了,而且这个问题去搜索都搜不出来了……请各位前辈指教。_

求助PDF.js的使用问题,搜索框怎么捕捉内容变化

要利用开源的PDF.js显示PDF,现在是通过直接改变搜索框的值 document.getElementById("findInput").value=txt; 我遇到的问题就是在改变搜索框里的值后,怎么加监听函数使得它立即响应搜索框值的变化,马上搜索新的值来来实现高亮显示

如何将JavaScript的变量转换成Java变量

网上关于这方面的资料不多,普遍的方法为通过一个隐藏的表单传送JS的变量。哪位大佬能写个这个转换的代码~ ``` var UD = getUrlParam('userId'); document.form.UD2.value = UD; </style> <body> <form method="post" action="UserDetail.jsp" id ="passForm"> <input id = "UD2" type = "hidden" name="UD2"> </form> var formObj = document.getElementById('passForm'); formObj.submit(); <% request.setCharacterEncoding("utf-8"); String UD3 = request.getParameter("UD2");%> ``` 通过网上的方法,即将UD转成UD3,无论怎么跑UD3的值都是null,求助求助~

如何获取同一个form表单里的对象的value值呢

``` <input type="hidden" id="district<%=i%>" name="district" > <script> document.getElementById("district"+i).value=document.getElementById("shuru"+i).value </script> ``` 如题,我想将hidden里的value 设置为上面id为shuru的的值 ``` <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@page import="Db.Db"%> <%@page import="java.text.SimpleDateFormat"%> <%@ page import="java.sql.*"%> <%@ page import="java.util.Date"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!-- 修改前--> <% request.setCharacterEncoding("utf-8"); String uaddr = null; int uid = 0; String uname = request.getParameter("uname"); String[] strgid = request.getParameterValues("addOrders"); Connection conn = null; Statement stmt = null; Statement stmt1 = null; ResultSet rs = null; ResultSet rs1 = null; conn = Db.getconn(); stmt = conn.createStatement(); stmt1 = conn.createStatement(); System.out.println(uname); rs1 = stmt1.executeQuery("select * from user where uname = '"+ uname + "' "); if (rs1.next()) { uaddr = rs1.getString("uaddr"); uid = rs1.getInt("uid"); } %> <% SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTime = sdf.format(new Date()); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>购物车</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> </head> <body> <form method="post" action="servlet/AddOrdersServlet" name="numSender"> <input type="hidden" name="uid" value="<%=uid%>"> <input type="hidden" name="uname" value="<%=uname%>"> <input type="hidden" name="oaddr" value="<%=uaddr%>"> <input type="hidden" name="dealtime" value="<%=nowTime%>"> <!-----script放到循环外-------> <script type="text/javascript"> function jianC(i,p1) { /*定义变量K,用商品数量输入框里面的数字赋值*/ var k =document.getElementById("shuru"+i);//获取数量输入控件 var v=parseInt(k.value,10); v--; /*点击-号按钮会递减商品价格*/ if (v < 1) { alert("亲,商品数量不能小于1!"); return//超限退出 } k.value=v; k.setAttribute('sum',v*p1)//将这个物品的小计放到自定义属性sum中,方便计算总价 setTotal()//重新设置总价钱 } function adddC(i,p1) { /*点击+号按钮会递加商品数量*/ var k =document.getElementById("shuru"+i);//获取数量输入控件 var v=parseInt(k.value,10); v++; if (v > 99) { alert("您所选择的数量已经到达库存上限!"); return//超限退出 } k.value=v; k.setAttribute('sum',v*p1)//将这个物品的小计放到自定义属性sum中,方便计算总价 setTotal()//重新设置总价钱 } function setTotal(){//设置总价 var o=document.getElementsByName('init_num');//获取数量输入框 var sum=0; for(var i=0;i<o.length;i++)sum+=parseInt(o[i].getAttribute('sum')||0) document.getElementById("cost").value = sum + "元" } function sendNum() { alert("xxxxxx"); document.getElementById("district"+i).value=document.getElementById("shuru"+i).value; alert("aaaaaaaaaaa"); } </script> <table border=1 align="center"> <tr> <td colspan="4" align="center">购物车</td> </tr> <tr> <td align="center">商品</td> <td align="center">数量</td> <td align="center" colspan="1">操作</td> </tr> <% for (int i = 0; i < strgid.length; i++) { int gid = Integer.parseInt(strgid[i]); rs = stmt.executeQuery("select * from goods where gid =" + gid); if (rs.next()) { String strgprice = rs.getString("gprice"); Double p =Double.parseDouble(strgprice); // System.out.println("p="+p); %> <!-- ss --> <tr> <td><img src="<%=rs.getString("gpicture")%>">&nbsp;<%=rs.getString("gname")%></td> <td><input type="button" id="jian" onClick="jianC(<%=i%>,<%=p%>)" value="-"><!-----传入循环i和单价-------> <input id="shuru<%=i%>" name="init_num" class="input_text" type="text" value="0" size="3"><!-----id连接上i变为唯一-------> <input type="hidden" id="district<%=i%>" name="district" > <script> document.getElementById("district"+i).value=document.getElementById("shuru"+i).value </script> <input type="button" id="addd" onClick="adddC(<%=i%>,<%=p%>)" value="+"><!-----传入循环i和单价-------></td> <td> <input type="checkbox" name="gid" value="<%=gid %>"> </td> </tr> <% } } rs.close(); rs1.close(); stmt.close(); stmt1.close(); conn.close(); %> <tr> <td colspan="4" align="center"> 总价:<input id="cost" class="input_text" type="text" value="0" size="3" value="0"></td> </tr> <tr> <td colspan="5" align="center"> <button id="buy_anniu" type="submit" onClick="sendNum()">提交</button> <button type="reset">重置</button> </td> </tr> </table> </form> </body> </html> ```

如何在父HTML中获取子HTML的控件ID

我在头部div设置了一个id,在主页引用头部,但是document.getElementById获取到的控件ID值为null,想问问各位大神应该怎么做??在线等.... 急......

看视频学习的案例,按着视频讲解去做的,但是浏览器报错了,说没定义,各位帮我看一下谢谢!

浏览器报错说 delTr 没有定义 ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> table{ border: 1px solid; margin: auto; width: 50%; } div{ margin: 50px; text-align: center; } th,td{ text-align: center; border: 1px solid; } </style> </head> <body> <div> <input type="text" id="id" name="number" placeholder="请输入编号"> <input type="text" id="name" name="name" placeholder="请输入姓名"> <input type="text" id="sex" name="sex" placeholder="请输入性别"> <input type="button" id="btn_add" value="添加"> </div> <table> <caption>学生信息表</caption> <tr> <th>编号</th> <th>姓名</th> <th>性别</th> <th>操作</th> </tr> <tr> <td>1</td> <td>周星驰</td> <td>男</td> <td><a href="javascript:void(0);" onclick="delTr(this);">删除</a></td> </tr> <tr> <td>2</td> <td>周润发</td> <td>男</td> <td><a href="javascript:void(0);" onclick="delTr(this);">删除</a></td> </tr> <tr> <td>3</td> <td>欧阳娜娜</td> <td>女</td> <td><a href="javascript:void(0);" onclick="delTr(this);">删除</a></td> </tr> </table> <script> //添加功能分析 /* 1。给添加按钮绑定事件 2.获取文本框内容 3。创建td,设置td的文本为文本框的内容 4.将td添加到tr中 6.获取table,将tr添加到table中 */ //删除功能分析 /* 1.确定点击的是哪一个超链接 <a href="javascript:void(0);" onclick="delTr(this);">删除</a> 2.怎么删除? removeChild():通过父节点删除子节点 */ var btn_add = document.getElementById("btn_add"); btn_add.onclick = function(){ //value 在输入框中 代表的是输入的内容 var id = document.getElementById("id").value; var name = document.getElementById("name").value; var sex = document.getElementById("sex").value; //创建td,赋值td的标签体 //id 的 td var td_id = document.createElement("td"); //创建文本节点 , 将id内容放进文本节点 var text_id = document.createTextNode(id); //将文本节点放进创建的 td 节点 td_id.appendChild(text_id); //name 的 td var td_name = document.createElement("td"); var text_name = document.createTextNode(name); td_name.appendChild(text_name); //sex 的 td var td_sex = document.createElement("td"); var text_sex = document.createTextNode(sex); td_sex.appendChild(text_sex); // a 标签 的 td var td_a = document.createElement("td"); //a是标签,所以还要创建a标签 var ele_a = document.createElement("a"); //创建 a标签的 属性 // .setAttribute("属性名","属性值"); ele_a.setAttribute("onclick","delTr(this);"); //设置属性,方便以后增加删除功能给予调用 ele_a.setAttribute("href","javascript:void(0);"); var text_a = document.createTextNode("删除"); //将“删除”添加到 a标签内 里 ele_a.appendChild(text_a); //将 a超链接添加到 td里 td_a.appendChild(ele_a); //创建tr var tr = document.createElement("tr"); //将 td 添加到 tr内 tr.appendChild(td_id); tr.appendChild(td_name); tr.appendChild(td_sex); tr.appendChild(td_a); //获取table , 通过标签名获取,虽然只有一个,但是TagName返回的是数组 var table = document.getElementsByTagName("table")[0]; table.appendChild(tr); //删除方法 此处的obj为形参 可随意起名 function delTr(obj){ var table = obj.parentNode.parentNode.parentNode; var tr = obj.parentNode.parentNode; table.removeChild(tr); } } </script> </body> </html> ```

showModalDialog后第一次不加载onload

这是调showModalDialog的方法 window.showModalDialog("aa.jsp",{},"dialogHeight:400px;dialogWidth:320px;center:yes;resizable:no;scroll:no;status:no;"); 调用后在弹出页中定义onload方法去给一个文本框赋值,然后加载一棵树 window.onload = function() { document.getElementById("aa").value = "aaaa"; initTree(); } 经常会在第一次打开这个页面的时候不加载onload方法(文本框也没有赋值,树也没加载),但是如果不加载,再点一次就好了,剩下的基本上每次都没问题,请问有人知道是什么原因吗 先谢了

JSp+ajax用户登录验证

[img]http://dl2.iteye.com/upload/attachment/0088/2001/4ee085e5-47e0-3995-ad42-62e4a53cfc2f.png[/img] 用户登陆界面,想要实现输入账号之后离开输入框就验证该账号是否存在,输入角色、账号、密码之后,点击登录,如果正确就跳转到index.jsp,错误不跳转并且在密码输入框下显示提示信息;有一个没输入就提示,信息也是在密码输入框下。 我现在的问题是:若果什么也不输,点击登录,会闪一下,但闪过之后就是重置了页面。输入正确也是闪一下就重置页面.账号验证没问题,就是登录有问题,但是搞不定,大侠们看看吧! login.jsp [code="java"]<form id="form" name="form" method="post" action="" > <table border="0"> <tr> <td align="right">角色类型:</td> <td><select name="role" id="role" onBlur="checkRole(this)"> <option value="0">-请选择角色-</option> <% List<Role> list = new ArrayList<Role>(); RoleDao dao = new RoleDaoImpl(); list = dao.findAllRoles();//调用实现类的查询全部方法 for (int i = 0; i < list.size(); i++) { Role r = list.get(i); %> <option value="<%=r.getR_id()%>"><%=r.getR_name()%></option> <% } %> </select> </td> <td align="left"> &nbsp; <span id="roleSpan"></span> </td> </tr> <tr> <td align="right">账号:</td> <td> <input type="text" name="number" id="number" onblur="checkNumber(this)"> </td> <td width="256" align="left"> &nbsp; <span id="numberSpan"></span> </td> </tr><!-- 当输入名字后离开输入框即调用--> <tr> <td align="right">密码:</td> <td><input type="password" name="pwd" id="pwd" onBlur="checkPsw(this)" > </td> <td align="left"> &nbsp; <span id="pwdSpan"></span> </td> </tr> <tr> <td align="left">&nbsp;<span id="feedback_info"></span></td> </tr> <tr> <td colspan="1"> <input type="submit" value="登录" onclick="checkLogin(this.form)"/> <input type="button" value="注册" onclick="javascript:window.location.href='User/Register.jsp'"></td> </tr> </table> </form>[/code] login.js [code="java"]var xmlHttp; function createXMLHttpRequest() { if (window.XMLHttpRequest) { var xmlHttp = new XMLHttpRequest(); //mozilla浏览器 } else if (window.ActiveXObject) { try { var xmlHttp = new ActiveX0bject("Msxml2.XMLHTTP"); //IE老版本 } catch (e) { } try { var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE新版本 } catch (e) { } } if (!xmlHttp) { window.alert("不能创建XMLHttpRequest对象实例"); return false; } else return xmlHttp; ////}///////花括号放错地方 } // 检查账号,给出提示信息 function checkNumber(Number) { var numberSpan = document.getElementById("numberSpan"); if (Number.value == "") { numberSpan.innerHTML = "账号必须填写".fontcolor("red"); return false; } else { xmlHttp = createXMLHttpRequest(); //createXMLHttpRequest申明的是局部变量,这里访问不到xmlHttp,要给xmlHttp变量赋值才行 var url="servlet/CheckNumberServlet?number="+Number.value+"&LoginTime="+new Date().getTime(); url = encodeURI(url); //转换码后再传输 xmlHttp.open("GET",url,true);//加时间戳防止IE缓存 //xmlhttp.setRequestHeader( "Content-Type", "text/html;charset=UTF-8" ); xmlHttp.onreadystatechange = handleStateChange1; xmlHttp.send(null); return true; } } function handleStateChange1() { var numberSpan = document.getElementById("numberSpan"); if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { // alert("来自服务器的响应:"+xmlHttp.responseText); if (xmlHttp.responseText == 'true') {///////responseText是字符串,不能和boolean变量直接比较 // alert("存在"); numberSpan.innerHTML = "<img src='Img/g.gif'>"; document.getElementById("feedback_info").innerHTML=""; return true; } else if (xmlHttp.responseText == 'false') {///////responseText是字符串,不能和boolean变量直接比较 // alert("不存在"); numberSpan.innerHTML = "账号不存在".fontcolor("red"); return false; } } else alert("服务器端错误"); } } // 检查密码,给出提示信息 function checkPsw(pswNode) { var spanNode1 = document.getElementById("pswSpan"); var Role= document.getElementById("role"); var Number= document.getElementById("number"); if (pswNode.value == "") { spanNode1.innerHTML = "密码必须填写".fontcolor("red"); return false; } else { pwdSpan.innerHTML = "<img src='Img/g.gif'>"; document.getElementById("feedback_info").innerHTML=""; return true; } } // 检查是否选中角色 function checkRole(selNode) { var index = selNode.selectedIndex;// 获得选中下标 var spanNode1 = document.getElementById("roleSpan"); if (index <= 0) { spanNode1.innerHTML = "必须选择角色".fontcolor("red"); return false; } else { spanNode1.innerHTML = "<img src='Img/g.gif'>"; document.getElementById("feedback_info").innerHTML=""; return true; } } // 检查表单 function checkLogin(o) { var Role=o.role; var Number= o.number; var Pwd= o.pwd; if(checkNumber(Number)&&checkPsw(Psw) &&checkRole(Role)) { xmlHttp = createXMLHttpRequest(); //createXMLHttpRequest申明的是局部变量,这里访问不到xmlHttp,要给xmlHttp变量赋值才行 var url="servlet/CheckLoginServlet?number="+Number.value+"&role="+Role.value+"&pwd="+Pwd.value+"&LoginTime="+new Date().getTime(); url = encodeURI(url); //转换码后再传输 xmlHttp.open("GET",url,true);//加时间戳防止IE缓存 //xmlhttp.setRequestHeader( "Content-Type", "text/html;charset=UTF-8" ); xmlHttp.onreadystatechange = handleStateChange2; xmlHttp.send(null); return true; } else{ document.getElementById("feedback_info").innerHTML="请填写每一项".fontcolor("red"); return false; } } function handleStateChange2() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { //alert("来自服务器的响应:" + xmlHttp.responseText); if(xmlHttp.responseText == '0'){ document.getElementById("feedback_info").innerHTML="账号与密码不匹配".fontcolor("red"); return false; } else if(xmlHttp.responseText == '1'){ document.getElementById("feedback_info").innerHTML=""; window.location.href="index.jsp"; return true; } } else alert("服务器端错误"); } }[/code] chuckLoginservlet [code="java"]public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); doPost(request, response);// 调用doPost方法 } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=UTF-8"); String number=""; try { number = new String(request.getParameter("number").getBytes( "ISO-8859-1"), "UTF-8"); } catch (Exception e1) { System.out.println("number为空"); } String role="0"; int rID=0; try { role = new String(request.getParameter("role").getBytes( "ISO-8859-1"), "UTF-8"); rID=Integer.parseInt(role);//把获得的role的值转成整型 } catch (Exception e1) { System.out.println(request.getParameter("role")+"******role"); } String pwd=""; try { pwd = new String(request.getParameter("pwd").getBytes( "ISO-8859-1"), "UTF-8"); } catch (Exception e) { System.out.println(request.getParameter("pwd")+"****pwd"); } // String txt = new String(number.getBytes("ISO-8859-1"), "UTF-8"); // System.out.println(txt+"********"); PrintWriter out = response.getWriter(); User u = new User(); UserDao ud = new UserDaoImpl(); u = ud.findUserByNumber(number);//通过账号找到用户对象 if (u != null) {// 找到该用户 int u_id = u.getU_id();// 获得该用户的ID UserRole ur = new UserRole(); UserRoleDao urd = new UserRoleDaoImpl(); ur = urd.findUserRoleByUserId(u_id);// 找到中间表UserRole的记录 int r_id = ur.getRole().getR_id();// 由Userrole表找到Role表的相对应角色名称 if (r_id==rID && u.getU_password().equals(pwd))// 如果数据中的角色和密码与之对应 { out.write("1");//1表示验证通过 } else { out.write("0");//0表示密码与账号不匹配 } } out.flush(); out.close(); }[/code]

C#用webkitbrowser怎么获取iframe文本框的值

textBox1.Text = webBrowser1.Document.Window.Frames[0].Document.GetElementById("username").GetAttribute("value"); webbrowser 换成webkitbrowser怎么获取

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

立即提问
相关内容推荐