我想要从隐藏字段中删除“^”分割的一组特定值 我在隐藏的领域中投入了价值。现在我想要删除特定值集,即
HIDDEN FIELD VALUE = 1 | 1 | 1 | 1 ^ 2 | 2 | 2 | 2 ^ 3 | 3 | 3 | 3
DROP DOWN =
INDEX | VALUE | TEXT
0 | 1 | 1
1 | 2 | 2
2 | 3 | 3
想要删除= ^ 2 | 2 | 2 | 2 WITH DROPDOWN VALUE 2;
这是我的代码,显示我如何将值放在隐藏字段
中function putinactions()
{
var hiddenfield = document.getElementById("hdfActions");
var ActList= document.getElementById("Actionlist");
var attdt= document.getElementById("txtAttOn");
var depen= document.getElementById("ddlDepend");
var tattby= document.getElementById("txtAttendedBy");
var dattby= document.getElementById("ddlAttendedBy");
var dpriority= document.getElementById("ddlPriority");
var taction= document.getElementById("txtAction");
var dstatus= document.getElementById("ddlStatus");
var tacdt= document.getElementById("txtACDt");
if(depen.value==9)
{
tattby.value = "0";
}
if(depen.value!=9)
{
dattby.value = "0";
}
if(hiddenfield.value=="")
{
hiddenfield.value=
attdt.value+"|"+
depen.value+"|"+
tattby.value+"|"+
dattby.value+"|"+
dpriority.value+"|"+
taction.value+"|"+
dstatus.value+"|"+
tacdt.value;
}
else
{
hiddenfield.value=hiddenfield.value+"^"+
attdt.value+"|"+
depen.value+"|"+
tattby.value+"|"+
dattby.value+"|"+
dpriority.value+"|"+
taction.value+"|"+
dstatus.value+"|"+
tacdt.value;
}
var optn = document.createElement("OPTION");
optn.text=attdt.value+"~~"+taction.value.substring(0,20)+"...";
optn.value=taction.value;
ActList.options.add(optn);
attdt.value="";
depen.value="";
taction.value="";
tacdt.value="";
}
答案 0 :(得分:0)
如果您对删除^字符所包含的值感兴趣,可以使用正则表达式。