使用codeignation框架:
<?php
$table_row = '<span style="white-space:nowrap">'.anchor('student/edit/'.$student->id,'edit').' | '.anchor('student/delete/'.$student->id,'delete',"οnclick=\" return confirm('Are you sure want to '+'delete the record for ".addslashes($student->s_name)." ?')\"").'</span>';
?>
1、整体是php,所以用.来连接字符串(因为太长,且不好控制)
2、confirm是javascript函数,所以连接字符串用+号
3、在javascript中,使用变量要用“”(但使用php变量,需要用.来连接字符串)
4、整体相当于echo "<span ....></span>";