Sunday, October 17, 2010

Tạo hiệu ứng liên kết kiểu dancing

Có khá nhiều kiểu hiệu ứng liên kết. Một trong số đó là kiểu hiệu ứng nhảy múa theo đó các đoạn text có link liên kết nhấp nháy theo các màu sắc khác nhau rất nổi bật.

Bạn chỉ việc đặt đoạn mã javascript dưới đây trước thẻ đóng </head>.
<script language="javascript">
<!-- Begin
function initArray() {
for (var i = 0; i < initArray.arguments.length; i++) {
this[i] = initArray.arguments[i];
}
this.length = initArray.arguments.length;
}
var colors = new initArray(
"red",
"blue",
"green",
"purple",
"black",
"tan",
"red");
delay = .5; // seconds
link = 0;
vlink = 2;
function linkDance() {
link = (link+1)%colors.length;
vlink = (vlink+1)%colors.length;
document.linkColor = colors[link];
document.vlinkColor = colors[vlink];
setTimeout("linkDance()",delay*1000);
}
linkDance();
// End -->
</script>

Bạn cũng có thể thêm màu sắc cho hiệu ứng này.
Tham khảo theo Javascript.internet.com.

No comments:

Post a Comment