doumu1873 2016-02-18 16:37
浏览 44
已采纳

codeigniter onmouseover不工作

i am fetching the image that would be used on the mousehover, the image is fetched but it just dont work in mousehover. it also works when i dont get the image from the database any ideas what i am doing wrong?

view:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 

<title>Products</title>

<!-- Bootstrap -->
    <?php echo link_tag('css/bootstrap.min.css')?>
    <!-- <link href="css/bootstrap.min.css" rel="stylesheet"> -->
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <link href='https://fonts.googleapis.com/css?family=Raleway:200' rel='stylesheet' type='text/css'>



    <link rel="stylesheet" type="text/css" href="css/STYLE01.css">
    <link rel="stylesheet" type="text/css" href="css/NAVIGATION.css">
    <link rel="shortcut icon" href="assets/ICON.PNG">

<style type="text/css">
::-webkit-scrollbar-thumb:vertical {
background-color: #EF426F; /*color of main scrollbar*/
height: 10px; /*height of scrollbar*/
}
::-webkit-scrollbar {
height: 0px;
width: 4px; /*width of the slider*/
background-color: #FFFFFF; /*color of the slider*/
}
body {
    background-image: url("assets/PRODUCTS_LOGOS.png");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
}
</style>
</head>

<body>




<div class="container">
    <center><br><br><br><br><br><br>
 <?php foreach ($category as $products): ?>


<a href="<?php echo base_url().'product_view/view_products/'.$products->id ?>"><img src="<?php echo base_url() . 'assets/' . $products->img_name . $products->ext; ?>" 
     onMouseOver="<?php echo base_url(). 'assets/'.$products->hover_img_name . $products->hover_ext;?>" onMouseOut="<?php echo base_url() . 'assets/' . $products->img_name . $products->ext; ?>" width="177" height="140"  width="177" height ="140"></a>'
   <?php endforeach; ?>
 <br><br><br><br><br></center>
</div>
</div>

<br><br><br><br>
<br><br><br><br>
<div class="footer_white">
I L L V M I N A T I O N &nbsp; S T U D I O S  <br> 2 0 1 5
</div>
<br><br>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>

<BODY onselectstart="return false;" ondragstart="return false;"> 
</body>
</html>

controller:

function index()
 {
   $this->load->helper(array('form'));
   $data['category'] = $this->User->get_category();
   $this->load->view('products_view',$data);
 }

model:

public function get_category(){
        $p = $this->db->query("select * from product_category");
        $p1 = $p->result();
        return $p1;
    }
  • 写回答

2条回答 默认 最新

  • dougui2254 2016-02-19 05:41
    关注

    We can not assign directly with event. Need property this.src

    Try this:

    <img src="<?php echo '\''.base_url() . 'assets/' . $products->img_name . $products->ext.'\''; ?>" 
     onMouseOver="this.src=<?php echo '\''.base_url(). 'assets/'.$products->hover_img_name . $products->hover_ext.'\'';?>" onMouseOut="this.src=<?php echo '\''.base_url() . 'assets/' . $products->img_name . $products->ext.'\''; ?>" width="177" height="140"  width="177" height ="140">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制