JavaScriptBank
New member
Hiệu ứng làm cho một ô sẽ đổi màu nền khi bạn rê chuột đến....
Demo:
Cách cài đặt
Bước 1: Dùng mã CSS bên dưới cho việc định dạng hiệu ứng
CSS
Bước 2: Dùng mã JavaScript để cài đặt hiệu ứng
JavaScript
Bước 3: Đặt mã HTML bên dưới vào phần BODY
HTML
Các hiệu ứng tương tự
-
-
-
Bạn có thể xem thêm nhiều JavaScript khác về
You must be registered for see links
You must be registered for see links
Demo:
You must be registered for see links
Cách cài đặt
Bước 1: Dùng mã CSS bên dưới cho việc định dạng hiệu ứng
CSS
Mã:
<STYLE>TD {
POSITION: relative
}
</STYLE>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Bước 2: Dùng mã JavaScript để cài đặt hiệu ứng
JavaScript
Mã:
<SCRIPT language=JavaScript>
// This is a cross-browser (IE5.5 & NN4.7) cell background changer
var oncell = "c0"
function chgColor(celno)
{
var chgcell
if (document.layers) { //browser is NN
for (var i = 1; i < 5; i++)
{
chgcell = "window.document.c" + i + ".bgColor='white'";
eval(chgcell);
}
chgcell = "window.document."+ celno + ".bgColor='orange'";
}
else // assume IE5
{for (var index =1; index < 5; index++)
{
clrIt = "document.getElementById('c"+ index +"').bgColor='white'";
eval(clrIt);
}
chgcell = "document.getElementById('"+ celno + "').bgColor='orange'";
}
eval(chgcell);
}
function overm(celno)
{ var chgcell
if (document.layers) { // browser is NN
chgcell = "window.document."+ celno + ".bgColor='yellow'";
}
else //assume IE
{
chgcell = "document.getElementById('"+ celno + "').bgColor='yellow'";
}
eval(chgcell);
}
function outm(celno)
{ var chgcell
if (document.layers) { // browser is NN
chgcell = "window.document."+ celno + ".bgColor='white'";
}
else //assume IE
{chgcell = "document.getElementById('"+ celno + "').bgColor='white'";
}
eval(chgcell);
}
</SCRIPT>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Bước 3: Đặt mã HTML bên dưới vào phần BODY
HTML
Mã:
<TABLE border=1>
<TBODY>
<TR>
<TD id=c1><A href="http://JavaScriptBank.com" onclick="oncell = 'c1'; chgColor('c1');" onmouseout="if (oncell != 'c1') {outm('c1');}" onmouseover="if (oncell != 'c1') {overm('c1');}">cell 1</A></TD>
<TD id=c2><A
href="http://JavaScriptBank.com"
onclick="oncell = 'c2'; chgColor('c2');"
onmouseout="if (oncell !='c2') {outm('c2');}"
onmouseover="if (oncell !='c2') {overm('c2');}">cell 2</A></TD>
<TD id=c3><A
href="http://JavaScriptBank.com"
onclick="oncell = 'c3'; chgColor('c3');"
onmouseout="if (oncell !='c3') {outm('c3');}"
onmouseover="if (oncell !='c3') {overm('c3');}">cell 3</A></TD>
<TD id=c4><A
href="http://JavaScriptBank.com"
onclick="oncell = 'c4'; chgColor('c4');"
onmouseout="if (oncell !='c4') {outm('c4');}"
onmouseover="if (oncell !='c4') {overm('c4');}">cell 4</A></TD></TR></TBODY></TABLE>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Các hiệu ứng tương tự
-
You must be registered for see links
-
You must be registered for see links
-
You must be registered for see links
Bạn có thể xem thêm nhiều JavaScript khác về
You must be registered for see links
và
You must be registered for see links
You must be registered for see links
-
You must be registered for see links
-
You must be registered for see links