<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	<style type="text/css">
		li{
			width: 200px;
			height: 50px;
			background-color: #080;
			list-style: none;
			margin: 10px;
			text-align: center;
			line-height: 50px;
			font-size: 30px;
			color: #fff;
		}
		.deepgreen{
			color: #020
		}
	</style>
</head>
<body>
	<ul>
		<li data-key='one' data-value='aa'>aa</li>
		<li data-key='two'  data-value='bb'>bb</li>
		<li data-key='three'  data-value='cc'>cc</li>
		<li data-key='four'  data-value='dd'>dd</li>
		<li data-key='five'  data-value='ee'>ee</li>
	</ul>
	<script type="text/javascript">
		$('li').on('click mouseover',function(){
			$(this).text($(this).data('key'));
			$(this).addClass('deepgreen');
		});
		$('li').on('mouseout',function(){
			$(this).text($(this).data('value'));
			$(this).removeClass('deepgreen');
		});
	</script>
</body>
</html>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Jerry 的頭像
    Jerry

    Bug倉庫 // 程式日記

    Jerry 發表在 痞客邦 留言(0) 人氣()