解决方案 »
- iframe javascript:location.replace(url)路径问题
- js简单问题
- 急 怎样得到mediaplayer的缓存条当前时间!!!
- 请问怎么在指定的框架内弹出新网页
- 如何访问iframe 里的对象?就是父网页访问子网页。
- toFixed 在IE5中是否不能使用呀?IE5用什么方法实现该函数的作用呢?
- WEB打印已经解决!JSP、ASP、HTML下页面的打印(套打),WEB打印最新插件,脚本SCRIPT,请看例子!
- 如何将数字转换成文字表达?很急
- 网页中嵌入的REAL文件在REALONE中如何屏蔽鼠标右键 ,用javascript可以实现吗?
- JS问题
- 为什么这个js不对啊,好烦恼
- IE浏览器,each放在getJSON函数外面不执行
var chsp = channel.split(',');
var str = "";
for(var i=1;i<=chsp.length;i++){ str += chsp[i-1] == 1 ? "<div>第"+i+"路:<input type=\"radio\" checked = \"checked\" value=\"1\" id=\"rdc"+i+"1\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"1\">开启</label> <input type=\"radio\" value=\"0\" id=\"rdc"+i+"0\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"0\">关闭</label></div>" : "<div>第"+i+"路:<input type=\"radio\" value=\"1\" id=\"rdc"+i+"1\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"1\">开启</label> <input type=\"radio\" checked = \"checked\" value=\"0\" id=\"rdc"+i+"0\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"0\">关闭</label></div>";
}
document.write(str);
话说,我自己这样写
$.each(channel, function(i){
if(channel[i]==1){
str +="<div>第"+i+"路:<input type=\"radio\" value=\"1\" checked=\"checked\" id=\"rdc"+i+"1\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"1\">开启</label> <input type=\"radio\" value=\"0\" id=\"rdc"+i+"0\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"0\">关闭</label></div>"
}else{
str +="<div>第"+i+"路:<input type=\"radio\" value=\"1\" id=\"rdc"+i+"1\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"1\">开启</label> <input type=\"radio\" value=\"0\" checked=\"checked\" id=\"rdc"+i+"0\" name=\"instruction_"+i+"\"><label for=\"rdc"+i+"0\">关闭</label></div>"
}
});是从0路开始算的。
那个字符串连接怎么改啊,要把i弄成i+1.
第"+(i+1)+"路