相关疑难解决方法(0)

使用Jquery在翻转时更改DIV背景

我是JQuery的新手,但已经很喜欢它了.

我试图在用户rollsovers时更改div的背景.但我不能让bg更新.到目前为止,这就是我所拥有的:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#fish{background-image:url(images/fish_off.jpg);width:459px;height:474px;}
</style>

 <script type="text/javascript" src="javascript/jquery.js"></script>     

 <script type="text/javascript">                                         
$('#fish').hover(
  function(){$('#fish').css({background: "url(images/fish_on.jpg)"})},
  function(){$('#fish').css({background: "url(images/fish_off.jpg)"})}
);


 </script>      

</head>

<body>

<div id="fish"></div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的测试页面,基于以下信息,我仍然遇到问题:

测试页面

html jquery

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

html ×1

jquery ×1