jQuery学习18---移动练习

来源:互联网 发布:windows10网络无法连接 编辑:程序博客网 时间:2024/06/05 23:47




<html><head><meta http-equiv="Content-Type" content="text/html;charset=GBK"><title></title><script src="../jquery-1.8.2.js" type="text/javascript"></script><style type="text/css">li{width:150px;cursor:pointer;}</style><script type="text/javascript">$(function(){$("#mv li").mouseover(function(){$(this).css("background-color","red");}).mouseout(function(){$(this).css("background-color","white");}).click(function(){//append把对象移过去,会带着对象的事件和样式,remove会移除对象的事件,不会移除样式//$(this).appendTo("#cn");$(this).css("background-color","white").remove().appendTo("#cn");})});</script></head><body><ul id="mv"><li>小张</li><li>小王</li><li>小刘</li><li>小李</li><li>小六</li></ul><hr/><ul id="cn"></ul></body></html>


原创粉丝点击