87,990
社区成员
发帖
与我相关
我的任务
分享
function $(v){return document.getElementById(v);}
function gInput(a,b){
var t="";
l=document.getElementsByName(a);
for(i=0;i<l.length;i++)
{
if(l[i].value)
{ t+=l[i].value+"|"
}
}
if(t){$(b).value="|"+t;}
}
<input name="tmpInput" id="position1" type="text" onblur="gInput('tmpInput','position')" />
<input name="tmpInput" id="position2" type="text" onblur="gInput('tmpInput','position')" />
<input name="tmpInput" id="position3" type="text" onblur="gInput('tmpInput','position')" />
<input name=position id="position" type="text" />
function $(v){return document.getElementById(v);}
var t='';
function gInput(a,b){
var temp="";
l=document.getElementsByName(a);
for(i=0;i<l.length;i++){
temp=l[i].value.replace(/^\s*|\s*$/g,'');
if(temp.length>0 && t.indexOf(temp)<0){
t+=temp+"|";
}
}
if(t.length>0){$(b).value="|"+t;}
}