关于ajax select 无限极联动修改时自动创建并选中时的问题
页面:<tr>
<td>产品名称</td>
<th id="proContent">
<select id="proname" name="proname" onchange="showChild()">
<option value="">请选择..</option>
<tpl:foreach collection="$PROLIST$" var="PRO" index="i">
<tpl:if test="$equals(PRO.ID,CINT(FIRSTPRO))$">
<tpl:set name="select" value="selected='selected'" />
<tpl:else />
<tpl:set name="select" value="" />
</tpl:if>
<option value="$PRO.ID$" $select$>$PRO.NAME$</option>
</tpl:foreach>
</select>
</th>
</tr>
下面是js: function showChild()
{
var obj=event.srcElement;
var currentObj=$$(obj);
var s1=$$(obj).nextAll("select");
s1.each(function(i){
$$(this).remove();
});
var value1=$$(obj).val();
$$.post("/ActionPage/Repertories.aspx?clsid="+value1,function(list){
eval(list)
if(list.length>0)
{
$$("<select id=\"no1"+value1+"\" name=\"proname\" onchange=\"showChild()\" ></select>").appendTo("#proContent");
$$("<option value=''>请选择..</option>").appendTo("#no1"+value1);
for (var i = 0; i < list.length; i++)
{
document.getElementById("no1"+value1).add(new Option(list[i].name,list[i].proid));
}
}
});
添加的时候可以实现联动。数据库的存的是以1,2,3的形式存放。
请问我修改的时候怎么让它自动创建select并选中呢?