标签:
index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JS之DivColorChange</title> <script type="text/javascript" src="jquery-1.10.1.js"></script> <script type="text/javascript" src="demo.js"></script> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div style="width:200px;height:200px;background:red;"> </div> </body> </html>
样式设置style.css:
.red { color:red; } .green { color:green; } .bg { background-color:#ccc; } .size { font-size:20px; }
.js是jquery的脚本文件,作用是实现图片缓存和加载。(文件已经上传)
执行效果如图:
标签:
原文地址:http://www.cnblogs.com/caidupingblogs/p/5087140.html