กำหนด link ลิ้งค์ ทั้งหมด ให้ เปิดหน้าต่างใหม่ ด้วย jQuery อย่างง่าย
HTML Code ตัวอย่าง
<a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br /> <a href="http://www.ninenik.com">ninenik.com</a><br />
jQuery Code ตัวอย่าง
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("a").hover(function(){
$(this).attr("target","_blank");
},function(){
$(this).removeAttr("target");
});
});
</script>
ตัวอย่าง ให้คลิก ลิ้งต์ต่างๆ ที่แสดงในหน้านี้
อ่าน 284

