onkeyup应该怎么写才行??谢谢各位指点下-----
时间:2011-11-16
来源:互联网
HTML code
function checkword(k,option) { url = "<%=path%>/crmProduct/crm_crmProductGetProductList.pop"; $.getJSON(url, null, function call(data) { outData(data,k,option); }); } cell1.innerHTML = "<input type=\"hidden\" name=\"crmOrderProductRelDTO.productIds\" > <input type=\"text\" name=\"crmOrderProductRelDTO.productNum\" onkeypress=\"event.returnValue=isString()\" onkeyup=\"checkword("+(newRow.rowIndex-1)+",1)\" style=\"width:100%;\"><div style=\"float:left; position: absolute; top:"+(200+30*(newRow.rowIndex-1))+"px;left:15px;width:127px;background:#ffffff; border:1px solid #666666;display:none;\" id=\"showmenu_"+(newRow.rowIndex-1)+"\"></div>"; cell1是一个文本框,现在情况是 输入任何字符有以下情况: 输入 纯数字 如 111 提示如 1111、1112、1113.。。 选择1111 保存后 文本框 显示1111 输入 数字+符号 如 333-3 提示如333-30 、333-31.。。 选择333-30 保存后 文本框 显示303 输入 数字+字母 如w33 提示如w332、w333、w334.。。 选择w332 无法提交到文本框中 也无法保存 现在想要实现 输入任何以上三种格式、选择提示后 可以选择 并且选择后 保存 显示正确 问题应该出现在上面贴的代码中吧 小弟这部分看不懂 有帮忙指教下的么?感激不尽= =!
作者: zhangjingtao6100 发布时间: 2011-11-16
这恐怕要按你的规则写上一大段处理程序的吧.
作者: qianjin036a 发布时间: 2011-11-16
引用 1 楼 qianjin036a 的回复:
这恐怕要按你的规则写上一大段处理程序的吧.
这恐怕要按你的规则写上一大段处理程序的吧.
现在主要问题出在 onkeyup里的checkword那句我不懂 他为什么那么写 传的数值是什么意思
别的应该没问题 能不能给指点一下
作者: zhangjingtao6100 发布时间: 2011-11-16
HTML code
function outData(data,k,option){ var wordvalue=null; var alltxt=null; var alltxtpp=null; var alltxt_xiang=null; var alltxt_xiang1=null; var isyou=0; var inhtml = ""; if(option==1){ wordvalue=document.getElementsByName("crmOrderProductRelDTO.productNum")[k].value.toLowerCase(); for(var i=0;i<data.productList.length;i++){ if(i==0){ alltxt=data.productList[i].productNum; }else{ alltxt=alltxt+"|"+data.productList[i].productNum; } } alltxtpp=alltxt.toLowerCase(); alltxt_xiang=alltxt.split("|"); alltxt_xiang1=alltxtpp.split("|"); for (i=0;i<alltxt_xiang1.length;i++) { if (alltxt_xiang1[i].substr(0,wordvalue.length)==wordvalue) { inhtml=inhtml+"<div style=\"clear:both;line-height:25px;\" onclick=\"document.getElementsByName('crmOrderProductRelDTO.orderQtys')["+k+"].value=''; document.getElementsByName('crmOrderProductRelDTO.productNum')["+k+"].value="+data.productList[i].productNum+"; document.getElementsByName('crmOrderProductRelDTO.productName')["+k+"].value='"+data.productList[i].productName+"'; document.getElementsByName('crmOrderProductRelDTO.productIds')["+k+"].value='"+data.productList[i].productId+"';document.getElementsByName('crmOrderProductRelDTO.orderValues')["+k+"].value='"+data.productList[i].proValue+"';document.getElementsByName('productQtys')["+k+"].value='"+data.productList[i].proQty+"'; document.getElementById('showmenu_"+k+"').style.display='none';\" onmouseover=\"this.style.backgroundColor='#70add6'\" onmouseout=\"this.style.backgroundColor=''\">"+alltxt_xiang[i]+"</div>"; isyou=1; } } if (isyou==1) { document.getElementById("showmenu_"+k).innerHTML=inhtml; document.getElementById("showmenu_"+k).style.display=""; } else { document.getElementById("showmenu_"+k).innerHTML=""; document.getElementById("showmenu_"+k).style.display="none"; } if (wordvalue=="") { document.getElementById("showmenu_"+k).innerHTML=""; document.getElementById("showmenu_"+k).style.display="none"; } }else{ wordvalue=document.getElementsByName("crmOrderProductRelDTO.productName")[k].value.toLowerCase(); for(var i=0;i<data.productList.length;i++){ if(i==0){ alltxt=data.productList[i].productName; }else{ alltxt=alltxt+"|"+data.productList[i].productName; } } alltxtpp=alltxt.toLowerCase(); alltxt_xiang=alltxt.split("|"); alltxt_xiang1=alltxtpp.split("|"); for (i=0;i<alltxt_xiang1.length;i++) { if (alltxt_xiang1[i].substr(0,wordvalue.length)==wordvalue) { inhtml=inhtml+"<div style=\"clear:both;line-height:25px;\" onclick=\"document.getElementsByName('crmOrderProductRelDTO.orderQtys')["+k+"].value=''; document.getElementsByName('crmOrderProductRelDTO.productNum')["+k+"].value="+data.productList[i].productNum+"; document.getElementsByName('crmOrderProductRelDTO.productName')["+k+"].value='"+data.productList[i].productName+"'; document.getElementsByName('crmOrderProductRelDTO.productIds')["+k+"].value='"+data.productList[i].productId+"';document.getElementsByName('crmOrderProductRelDTO.orderValues')["+k+"].value='"+data.productList[i].proValue+"';document.getElementsByName('productQtys')["+k+"].value='"+data.productList[i].proQty+"'; document.getElementById('showmenu1_"+k+"').style.display='none';\" onmouseover=\"this.style.backgroundColor='#70add6'\" onmouseout=\"this.style.backgroundColor=''\">"+alltxt_xiang[i]+"</div>"; isyou=1; } } if (isyou==1) { document.getElementById("showmenu1_"+k).innerHTML=inhtml; document.getElementById("showmenu1_"+k).style.display=""; } else { document.getElementById("showmenu1_"+k).innerHTML=""; document.getElementById("showmenu1_"+k).style.display="none"; } if (wordvalue=="") { document.getElementById("showmenu1_"+k).innerHTML=""; document.getElementById("showmenu1_"+k).style.display="none"; } } }
作者: zhangjingtao6100 发布时间: 2011-11-16
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28