Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在动态创建的HTML表中编写Javascript If条件_Javascript_Jquery_Html - Fatal编程技术网

在动态创建的HTML表中编写Javascript If条件

在动态创建的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->

我的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->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>';