jquery 如何更改类名 <div id="user" class="current"> </div> <script type="text/javascript"> var temp = $("#user"); $("#user").hover( function() { $(this).addClass("aaa");}, function() { $(this).removeClass().addClass("ttt");} ); </script>以上代码运行之后无法更改class 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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>无标题文档 </title> <script language="javascript" src="jquery.js"> </script> <style>.current { background-color: #000; }.aaa { background-color: red; }.ttt { background-color: blue; }</style></head> <body> <div id="user" class="current">Test</div> <script type="text/javascript"> var temp = $("#user"); $("#user").hover( function() { $(this).removeClass().addClass("aaa");}, function() { $(this).removeClass().addClass("ttt");} ); </script></body> </html> 汗,走入误区了,以为更换了类名之后源代码变成以下<div id="user" class="ttt">Test</div> .net环境下,javascript中导出.csv文件 图片显示问题 求救,document为空! ajax聊天室 大家帮忙看看 请问:如何将java解析的xml文件的数据.输入到页面的表单上? 给table添加行问题,谢谢,在线等 求助!Java web 调用本地摄像头100分 ▲关于Asp跳转页面的难题,高分求助! ▲ 有一个网页,上面有许多javascript函数,我如何调用这些函数? 紧急求救!关于在Web上打印出两图互相穿插的图片!! 大家帮看下这段代码,为什么执行ASP:BUTTON的CLICK事件失败啊? js 设置焦点在网页的位置
<!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>无标题文档 </title>
<script language="javascript" src="jquery.js"> </script>
<style>
.current { background-color: #000; }
.aaa { background-color: red; }
.ttt { background-color: blue; }
</style>
</head>
<body>
<div id="user" class="current">Test</div>
<script type="text/javascript">
var temp = $("#user");
$("#user").hover(
function() {
$(this).removeClass().addClass("aaa");},
function() {
$(this).removeClass().addClass("ttt");}
);
</script>
</body>
</html>