<%u=0
do while not rs.eof
u=u+1
%>
<tr>
<td><input type="checkbox" name="checktype" value="<%=u%>"></td>
<td ><input type=text name="pAddress<%=u%>" id="pAddress<%=u%>"></td>
</tr>........想实现的功能是先选择复选框,然后地址栏中任意填入一个,那么选中的就都附上该值
do while not rs.eof
u=u+1
%>
<tr>
<td><input type="checkbox" name="checktype" value="<%=u%>"></td>
<td ><input type=text name="pAddress<%=u%>" id="pAddress<%=u%>"></td>
</tr>........想实现的功能是先选择复选框,然后地址栏中任意填入一个,那么选中的就都附上该值
<tr>
<td><input type="checkbox" name="checktype" value="<%=u%>"></td>
<td ><input type=text name="pAddress<%=u%>" onBlur="addvalue()" id="pAddress<%=u%>"></td>
</tr>
function addvalue(){
var cbs=document.getElementByTagNames('input');
for(var i=0;i<cbs.lenth;i++){
if(cbs[i].type=="checkbox"){
if(cbs[i].checked==true){
cbs[i].value=document.getElementById('pAddress<%=u%>').value;
}
}
}
}
你必须厉遍所有的checkbox
var cbs=document.getElementByTagNames('input');
for(var i=0;i<cbs.lenth;i++){
if(cbs[i].type=="checkbox"){
if(cbs[i].checked==true){
cbs[i+1].value=document.getElementById('pAddress<%=u%>').value;
}
}
}
}
u循环是在页面加载完之前就完成了
而js是等你的页面加载完之后才发生作用的