在动态创建的HTML表中编写Javascript If条件
我的JS在动态创建的HTML表中编写Javascript If条件,javascript,jquery,html,Javascript,Jquery,Html,我的JS 对于(var i=0;i可以使用三元运算符 + '</td><?php } ?>'+if("something" == "something")+'<td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->
对于(var i=0;i可以使用三元运算符
+ '</td><?php } ?>'+if("something" == "something")+'<td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->baseUrl(); ?>/images/edit_icon.png" height="20px" width="20px"></a>'
+ '</td></tr>';
+''+(x==5?'true':'false')+''
您可以使用三元运算符
+ '</td><?php } ?>'+if("something" == "something")+'<td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->baseUrl(); ?>/images/edit_icon.png" height="20px" width="20px"></a>'
+ '</td></tr>';
+''+(x==5?'true':'false')+''
+''+(“某物”=“某物”?''”)+'';
可能会成功。+''+(“某物”=“某物”?'')+'';
可能会起作用。php脚本不会在javascript中处理php脚本不会在javascript中处理
+ '<tr>' + (x == 5 ? '<td>true</td>' : '<td>false</td>') + '</tr>'
+ '</td><?php } ?>'+ ("something" == "something" ? '<td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->baseUrl(); ?>/images/edit_icon.png" height="20px" width="20px"></a></td>' : '') + '</tr>';