class id 区别

【1】、id是唯一的,一个元素只能有一个,不能重复class可以重复  

<div>
	<img src="" width="100%"/>
	<div class="duihao" id="duihao11">
		<img id="duihao1" name='A' src="" />
	</div>
	<div class="duihao" id="duihao22">
		<img id="duihao2" name='B' src="" />
	</div>
	<div class="duihao" id="duihao33">
		<img id="duihao3" name='C' src="" />
	</div>
	<div class="duihao" id="duihao44">
		<img id="duihao4" name='D' src="" />
	</div>
	<div class="duihao" id="duihao55">
		<img id="duihao5" name='E' src="" />
	</div>
	<div class="duihao" id="duihao66">
		<img id="duihao6" name='F' src="" />
	</div>	
</div>

<script>
$(function(){
	$(".duihao").click(function(){
		$(this).children().css("visibility","visible");
		var a = $(this).children().attr("name");
		 setTimeout(function(){
			window.location="url?func=cha&pubid={$pubid}&type="+a;
		},1000);
	});
})
</script>

  

posted @ 2015-07-06 13:37  冷暖自知一抹茶ck  阅读(270)  评论(0编辑  收藏  举报