【发布时间】:2016-11-21 19:59:12
【问题描述】:
我有一个 javascript 函数可以在 div innerhtml 中调用这个结果。单击按钮时如何提醒“警报功能”?
$html.='<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th width="5%">#</th>
<th>Title</th>
<th>Action</th>
</tr>
</thead>
<tbody>';
$c=1;
foreach($titles AS $item){
$html.='<tr>
<td>'.$c.'</td>
<td>'.urldecode($item->title_content).'</td>
<td><button type="button" class="btn btn-danger" onclick="alert(\'**Alert Function**\')">Delete</button></td>
</tr>';
$c++;
}
$html.='</tbody>
</table>';
echo $html;
谢谢
【问题讨论】:
-
这段代码有什么问题?
-
实际上上面的代码是由 javascrip 调用的,我使用 ajax 将值传递给控制器,然后在 div 中使用 innerhtml 视图。当它显示在 div 上时,但 onclick 按钮不起作用。
标签: javascript php innerhtml codeigniter-3