2017-02-25 71 views
0

當鼠標懸停時,我需要從數據庫中使用表格(如下圖所示)獲取並顯示數據,並在鼠標懸停時消失。如何在鼠標懸停時顯示來自表格的其他數據

這裏是模式

public function teacher_with_subject(){ 
    $this->db->select('*') 
    ->from('teacher AS t') 
    ->join('teacher_subject ts','t.computer_number=ts.computer_number', 'left') 
    ->where('t.date_of_termination','0000-00-00') 
    ->where('ts.date_of_end','0000-00-00'); 
    $query = $this->db->get(); return $query->result_array(); 
} 

控制器

$located=$this->select_model->teacher_with_subject(); 

視圖: -

if (count($located) > 0) { 
    echo '<table>'; 

    foreach($located as $locate){ 
     echo "<tr><td>".$locate['computer_number']."</td><td>".$locate['name']."</td><"</td><td><img src=". base_url()."inc/images/confirm.png width='45' height='30' border='0' class='computer_number' data-id='".$locate['computer_number']."'/></td></tr>"; 
    } 
    echo '</table>'; 
} 

我想當鼠標懸停名

+1

爲什麼Java標記? – yashpandey

+0

對不起,它是JavaScript而不是Java –

回答

0

使用title屬性顯示的郵寄地址和電子郵件地址:

echo "<tr>"; 
echo "<td>".$locate['computer_number']."</td>"; 
echo "<td title='".$locate["email"]."<br />".$locate["address"]."'>".$locate['name']."</td>"; 
echo "<td><img src=". base_url()."inc/images/confirm.png width='45' height='30' border='0' class='computer_number' data-id='".$locate['computer_number']."'/></td>"; 
echo "</tr>"; 
相關問題