else if(result_str.indexOf('width') > -1){
if(typeof(value) == 'string'){
if(value.indexOf('px') > -1){
console.log('aaa');
value = value.match(/(.*?)px/)[1];
$('#'+result_str).val(value);
}
}
}else{
//console.log(result_str + ':' + value);
$('#'+result_str).val(value);
}
if(typeof(value) == 'string'){
if(value.indexOf('px') > -1){
console.log('aaa');
value = value.match(/(.*?)px/)[1];
$('#'+result_str).val(value);
}
}
}else{
//console.log(result_str + ':' + value);
$('#'+result_str).val(value);
}
是想result_str中带'width', 并且value是string,而且含'px', 符合这个条件才执行里面的操作
但是这样chart-width就只进入第一层分支, 因为不是string而没进入第二层分支, 而又不会进入最下面的else分支: $('#'+result_str).val(value). 这样chart-width对应的value就是空了
应把这几层循环 写在与最下面else同一层, 连接词是and
这么基础的bug.都出现了, 而以前也没考虑过 多层循环 与 一层多条件 的区别
1129

被折叠的 条评论
为什么被折叠?



