Hoang_philong
26-08-09, 01:13 AM
Bạn có 1 blog, blog của bạn đã trao đổi logo với rất nhiều blog khác, nhưng vì nhiều logo quá nên bạn không thể 1 lúc thể hiện chúng lên trang được. Trường hợp này 1 là có thể được giải quyết bằng cách cho logo chạy ngang hoặc dọc (dùng thẻ MARQUEE), 2 là có thể cho hiện một số lượng logo nhất định rồi các logo còn lại sẽ thay thế logo đó theo thời gian. Dưới đây là code cần cho cách 2.
<div id="logoexc" align="center">Loading Logos...</div>
<script type="text/javascript">
var avx = new Array(); var avy = new Array();
avx[0]="http://ziczic.com"; avy[0]="http://anhvo.info.googlepages.com/iziclogogif.gif";
avx[1]="http://www.tuanvuonline.com"; avy[1]="http://thanhroe.googlepages.com/logo-tvol-130x60.png";
avx[2]="http://hadung.net"; avy[2]="http://hadung.sky.vn/files/2008/05/hadunglogo.gif";
avx[3]="http://thuvientre.uni.cc"; avy[3]="http://i70.photobucket.com/albums/i118/minhtriphoto/pc/logopc.gif";
avx[4]="http://haitvonline.blogspot.com"; avy[4]="http://files.myopera.com/haitvonline/files/haitvonline.gif";
avx[5]="http://caotronghien.blogspot.com"; avy[5]="http://farm3.static.flickr.com/2211/1629426742_23bdfa3c97_t.jpg";
avx[6]="http://sinhhoc.org"; avy[6]="http://files.myopera.com/tncdocument/files/logosongnhuthenao.gif";
avx[7]="http://ku-ty.com"; avy[7]="http://tungnguyen1979.googlepages.com/Logo.gif";
avx[8]="http://ekiemtien.com"; avy[8]="http://ekiemtien.com/images/ekt.gif";
target = "_blank";
rnd = "y";
numlg = 4;
width = 130;
height = 60;
border = 1;
margin = 2;
space = "<br/>";
intervan = 10;
// No need for change;
d = avx.length;
if(numlg>d) {numlg = d;}
var rd;
rd = (rnd=="y") ? Math.floor(d*Math.random()) : 0;
for(i=0;i<d;i++){
j = i ;
if(j>=d) j = j-d;
document.write('<img style="display:none; visibility:hidden" src="'+avy[j]+'"/>');
}
st = ''; str = '';
function logoref(st2) {
for(i=st2;i<st2+numlg;i++){
j = i;
space2 = (i==st2+numlg-1) ? '' : space;
if(j>=avx.length) j = j - avx.length;
margin = Math.round(margin/2);
str += '<a href="'+avx[j]+'" target='+target+' title="'+avx[j]+'"><img alt="'+avx[j]+'" width="'+width+'" border="'+border+'" height="'+height+'" src="'+avy[j]+'" style="margin:'+margin+'"/></a>'+space2;
}
document.getElementById("logoexc").innerHTML = str ;
st = st+numlg;
if (st >= avx.length) { st = st - avx.length; }
str = '';
setTimeout("Refresh()",intervan*600);
}
function Refresh()
{
if(st=='') st = rd;
setTimeout("logoref(st)",intervan*400);
}
onLoad = Refresh();
</script>
Đoạn code màu đỏ là link logo và link blog. Cấu trúc như sau:
avx[i] = "link blog"; avy[i] = "link logo";
chỉ số i có thể chạy từ 0 đến con số tùy ý, khi bạn có thêm logo và link mới vì chỉ cần thêm tiếp vào dòng cuối cùng của mã đỏ này. Ví dụ:
avx[11] = ...; avy[11] = ....
Bây giờ tới chỗ in đậm:
TARGET khi mở blog, bạn đặt "_blank" nếu như muốn mở blog ở 1 trang mới, không thì đặt TARGET là "_self".
rnd : chế độ logo ngẫu nhiên, bật nếu giá trị là y, tắt là n
numlg : số logo muốn hiện
width, height: rộng và dài của logo
border : độ rộng đường viền quanh mỗi logo
space : chế độ hiện logo, giá trị là nếu muốn logo hiện thành dòng, giá trị là
hoặc
--------------------------------------------------------------------------------
nếu muốn logo hiện thành cột.
intervan : khoảng thời gian mỗi lượt thay đổi logo (tính bằng giây).
Sau khi thay đổi xong các tham số trên, bạn chèn code vào bất cứ nơi nào muốn hiện logo.
** Nếu bạn chèn đoạn code trên vào mà không chạy được thì hãy thay nó bằng đoạn code sau:
<div id="logoexc" align="center">Loading Logos...</div>
<script type="text/javascript">
var avx = new Array(); var avy = new Array();
avx[0]="http://ziczic.com";
avy[0]="http://anhvo.info.googlepages.com/iziclogogif.gif";
avx[1]="http://www.tuanvuonline.com";
avy[1]="http://thanhroe.googlepages.com/logo-tvol-130x60.png";
avx[2]="http://hadung.net";
avy[2]="http://hadung.sky.vn/files/2008/05/hadunglogo.gif";
avx[3]="http://thuvientre.uni.cc";
avy[3]="http://i70.photobucket.com/albums/i118/minhtriphoto/pc/logopc.gif";
avx[4]="http://haitvonline.blogspot.com";
avy[4]="http://files.myopera.com/haitvonline/files/haitvonline.gif";
avx[5]="http://caotronghien.blogspot.com";
avy[5]="http://farm3.static.flickr.com/2211/1629426742_23bdfa3c97_t.jpg";
avx[6]="http://sinhhoc.org";
avy[6]="http://files.myopera.com/tncdocument/files/logosongnhuthenao.gif";
target = "_blank";
rnd = "y";
numlg = 4;
width = 130;
height = 60;
border = 1;
margin = 2;
space = "<br/>";
intervan = 10;
</script>
<script type="text/javascript" src="http://anhvo.info.googlepages.com/logothaydoi.js"></script>
Theo Nguồn : vietwebguide.com
<div id="logoexc" align="center">Loading Logos...</div>
<script type="text/javascript">
var avx = new Array(); var avy = new Array();
avx[0]="http://ziczic.com"; avy[0]="http://anhvo.info.googlepages.com/iziclogogif.gif";
avx[1]="http://www.tuanvuonline.com"; avy[1]="http://thanhroe.googlepages.com/logo-tvol-130x60.png";
avx[2]="http://hadung.net"; avy[2]="http://hadung.sky.vn/files/2008/05/hadunglogo.gif";
avx[3]="http://thuvientre.uni.cc"; avy[3]="http://i70.photobucket.com/albums/i118/minhtriphoto/pc/logopc.gif";
avx[4]="http://haitvonline.blogspot.com"; avy[4]="http://files.myopera.com/haitvonline/files/haitvonline.gif";
avx[5]="http://caotronghien.blogspot.com"; avy[5]="http://farm3.static.flickr.com/2211/1629426742_23bdfa3c97_t.jpg";
avx[6]="http://sinhhoc.org"; avy[6]="http://files.myopera.com/tncdocument/files/logosongnhuthenao.gif";
avx[7]="http://ku-ty.com"; avy[7]="http://tungnguyen1979.googlepages.com/Logo.gif";
avx[8]="http://ekiemtien.com"; avy[8]="http://ekiemtien.com/images/ekt.gif";
target = "_blank";
rnd = "y";
numlg = 4;
width = 130;
height = 60;
border = 1;
margin = 2;
space = "<br/>";
intervan = 10;
// No need for change;
d = avx.length;
if(numlg>d) {numlg = d;}
var rd;
rd = (rnd=="y") ? Math.floor(d*Math.random()) : 0;
for(i=0;i<d;i++){
j = i ;
if(j>=d) j = j-d;
document.write('<img style="display:none; visibility:hidden" src="'+avy[j]+'"/>');
}
st = ''; str = '';
function logoref(st2) {
for(i=st2;i<st2+numlg;i++){
j = i;
space2 = (i==st2+numlg-1) ? '' : space;
if(j>=avx.length) j = j - avx.length;
margin = Math.round(margin/2);
str += '<a href="'+avx[j]+'" target='+target+' title="'+avx[j]+'"><img alt="'+avx[j]+'" width="'+width+'" border="'+border+'" height="'+height+'" src="'+avy[j]+'" style="margin:'+margin+'"/></a>'+space2;
}
document.getElementById("logoexc").innerHTML = str ;
st = st+numlg;
if (st >= avx.length) { st = st - avx.length; }
str = '';
setTimeout("Refresh()",intervan*600);
}
function Refresh()
{
if(st=='') st = rd;
setTimeout("logoref(st)",intervan*400);
}
onLoad = Refresh();
</script>
Đoạn code màu đỏ là link logo và link blog. Cấu trúc như sau:
avx[i] = "link blog"; avy[i] = "link logo";
chỉ số i có thể chạy từ 0 đến con số tùy ý, khi bạn có thêm logo và link mới vì chỉ cần thêm tiếp vào dòng cuối cùng của mã đỏ này. Ví dụ:
avx[11] = ...; avy[11] = ....
Bây giờ tới chỗ in đậm:
TARGET khi mở blog, bạn đặt "_blank" nếu như muốn mở blog ở 1 trang mới, không thì đặt TARGET là "_self".
rnd : chế độ logo ngẫu nhiên, bật nếu giá trị là y, tắt là n
numlg : số logo muốn hiện
width, height: rộng và dài của logo
border : độ rộng đường viền quanh mỗi logo
space : chế độ hiện logo, giá trị là nếu muốn logo hiện thành dòng, giá trị là
hoặc
--------------------------------------------------------------------------------
nếu muốn logo hiện thành cột.
intervan : khoảng thời gian mỗi lượt thay đổi logo (tính bằng giây).
Sau khi thay đổi xong các tham số trên, bạn chèn code vào bất cứ nơi nào muốn hiện logo.
** Nếu bạn chèn đoạn code trên vào mà không chạy được thì hãy thay nó bằng đoạn code sau:
<div id="logoexc" align="center">Loading Logos...</div>
<script type="text/javascript">
var avx = new Array(); var avy = new Array();
avx[0]="http://ziczic.com";
avy[0]="http://anhvo.info.googlepages.com/iziclogogif.gif";
avx[1]="http://www.tuanvuonline.com";
avy[1]="http://thanhroe.googlepages.com/logo-tvol-130x60.png";
avx[2]="http://hadung.net";
avy[2]="http://hadung.sky.vn/files/2008/05/hadunglogo.gif";
avx[3]="http://thuvientre.uni.cc";
avy[3]="http://i70.photobucket.com/albums/i118/minhtriphoto/pc/logopc.gif";
avx[4]="http://haitvonline.blogspot.com";
avy[4]="http://files.myopera.com/haitvonline/files/haitvonline.gif";
avx[5]="http://caotronghien.blogspot.com";
avy[5]="http://farm3.static.flickr.com/2211/1629426742_23bdfa3c97_t.jpg";
avx[6]="http://sinhhoc.org";
avy[6]="http://files.myopera.com/tncdocument/files/logosongnhuthenao.gif";
target = "_blank";
rnd = "y";
numlg = 4;
width = 130;
height = 60;
border = 1;
margin = 2;
space = "<br/>";
intervan = 10;
</script>
<script type="text/javascript" src="http://anhvo.info.googlepages.com/logothaydoi.js"></script>
Theo Nguồn : vietwebguide.com