| 
 | 
 
 本帖最后由 consatan 于 2010-1-6 16:09 编辑  
 
想通过table的模板来实现双击表格行打开超链接 
但是如何将数据库中的id号传递到模板中呢?? 
HTML复制代码 <tr ondblclick="parent.location=\'company/MyTable\'">   复制代码 
链接应该是company/MyTable/id,可是这个id如何传递过来?? 
或者有什么别的方法可以实现我说的这功能吗? 
 
PHP复制代码 function index () {
   $this->load->model('Company_Model','Company');
   $result = $this->Company->show_company();
   $data = array('title'  => '厂商列表',
          'message' => '厂商列表',
          'values'  => $result
          );
   $tmpl = array (
                  'table_open'         => '<table border="0" cellspacing="0">',
 
                    //'row_start'          => '<tr ondblclick="parent.location=\'company/MyTable\'" onMouseOut="this.style.background=\'\'" onMouseOver="this.style.background=\'#DCE6EE\'">',
                    'row_start'          => '<tr ondblclick="alert($result[\'id\'])" onMouseOut="this.style.background=\'\'" onMouseOver="this.style.background=\'#DCE6EE\'">',
 
                    //'row_alt_start'      => '<tr ondblclick="parent.location=\'company/MyTable\'" onMouseOut="this.style.background=\'#ECF2F6\'" onMouseOver="this.style.background=\'#DCE6EE\'" style="background=#ECF2F6" >',
                    'row_alt_start'      => '<tr ondblclick="alert($result[\'id\'])" onMouseOut="this.style.background=\'#ECF2F6\'" onMouseOver="this.style.background=\'#DCE6EE\'" style="background=#ECF2F6" >',
              );
   $this->table->set_template($tmpl); 
   $this->table->set_caption('厂商列表');
   $this->table->set_heading('ID', '简称', '全称','联系人');
   $this->load->view('show_company',$data);
  }  复制代码 |   
 
 
 
 |