中关村商城广告切换纯净代码

效果如图:

[img]/upload/attachment/133593/e1c0c9d8-c419-3897-8a7e-52e43444d869.jpg[/img]

原以为用firebug把页面主要代码搞下来后或许会产生些错误,结果没想到弄下来后啥错误都没有。。呵呵。。。只要把样式也搞下来就行了。。

效果网址:http://www.5mdn.com/adtest.htm

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>
<title></title>
<style type="text/css">
/* 全局CSS定义 */
body
{
font: 12px/20px simsun;
color: #333;
margin: 0;
}
div, form, img, ul, ol, li, dl, dt, dd, h1, h2
{
margin: 0;
padding: 0;
border: 0;
}
div, img, input, select, ul, dl, dt, dd
{
float: left;
}
h2
{
display: inline;
}
ul
{
list-style-type: none;
}
a
{
text-decoration: none;
color: #333;
}
a:hover, div a:hover, .Alc dt a:hover
{
text-decoration: underline;
color: #f60;
}
/* 颜色属性 */
.bai12
{
color: #fff;
}
.hui6
{
color: #666;
}
.hui9
{
color: #999;
}
.hoc
{
color: #c00;
}
.lan12, .fa a, fia a
{
color: #36c;
}
.fal
{
font-family: arial;
}
.hoc12, .ho14b, .ho12b
{
color: #c00;
}
.lan12, .lan12i, .fa a, .lan14b, .lan14, .fia a, .A_back, .lan14bi
{
color: #36c;
}
.fi, .lan12i, .fia a, .A_back, .lan14bi
{
text-decoration: underline;
}
.b
{
font-weight: bold;
}
/* 滚动广告样式 */
.Am_1
{
width: 540px;
position: relative;
}
.Am_1 img
{
padding: 1px;
border: 1px solid #D0E1F0;
}
.Am_1 ul
{
position: absolute;
width: 135px;
top: 0;
right: 0;
border-top: 1px solid #BED5EC;
line-height: 16px;
}
.Am_1 li
{
width: 115px;
padding: 11px 10px;
height: 33px;
float: left;
background: url(http://icon.zol-img.com.cn/zol_mall/index/0905/a1.gif);
}
.Am_1 li.act
{
padding-left: 18px;
height: 34px;
background-position: 0 -60px;
margin: -1px 0 -1px -8px;
position: relative;
color: #c00;
}
.Am_1 li.act a
{
color: #c00;
}
.Am_1 li.act a:hover
{
color: #f60;
}
</style>
</head>
<body>
<div class="Am_1">
<div style="width: 406px; height: 220px;" id="fc">
<div style="display: none;">
<a title="佳能500D 1510万像素 超值套装低价抢购" target="_blank" href="http://www.zol.com/detail/1/goods_6b6de6c8b15a34fbf9bf7bf0861f9c1f.html">
<img border="0" src="http://admin.zol.com/article/picture/module/6_module_images/389.jpg"
onmouseout="setAuto()" onmouseover="clearAuto();" /></a></div>
<div style="display: block;">
<a title="技嘉M1022中关村商城首发" target="_blank" href="http://www.zol.com/detail/6/goods_711e9a9bacc7e0fa529d6901052af061.html">
<img border="0" src="http://admin.zol.com/article/picture/module/6_module_images/386.gif"
onmouseout="setAuto()" onmouseover="clearAuto();" /></a></div>
<div style="display: none;">
<a title="GARMIN 610 中关村商城 超低价促销" target="_blank" href="http://www.zol.com/detail/1/goods_6a7fc17474ae6786eb1525c8b0f90169.html">
<img border="0" src="http://admin.zol.com/article/picture/module/6_module_images/388.gif"
onmouseout="setAuto()" onmouseover="clearAuto();" /></a></div>
<div style="display: none;">
<a title="卡巴斯基 全功能安全软件2010(三年版)" target="_blank" href="http://www.zol.com/detail/6/goods_f64fb5bd61088b47e5fa2e23d5a0bdf7.html">
<img border="0" src="http://admin.zol.com/article/picture/module/6_module_images/378.jpg"
onmouseout="setAuto()" onmouseover="clearAuto();" /></a></div>
</div>
<ul id="show_text">
<li class=""><span onmouseout="setAuto()" onmouseover="clearAuto();Mea(0);"><a title="佳能500D 1510万像素 超值套装低价抢购"
target="_blank" href="http://www.zol.com/detail/1/goods_6b6de6c8b15a34fbf9bf7bf0861f9c1f.html">
佳能500D 1510万像素 超值套装低价抢购</a></span></li><li class="act"><span onmouseout="setAuto()"
onmouseover="clearAuto();Mea(1);"><a title="技嘉M1022中关村商城首发" target="_blank" href="http://www.zol.com/detail/6/goods_711e9a9bacc7e0fa529d6901052af061.html">
技嘉M1022中关村商城首发</a></span></li><li class=""><span onmouseout="setAuto()" onmouseover="clearAuto();Mea(2);">
<a title="GARMIN 610 中关村商城 超低价促销" target="_blank" href="http://www.zol.com/detail/1/goods_6a7fc17474ae6786eb1525c8b0f90169.html">
GARMIN 610 中关村商城 超低价促销</a></span></li><li class="" style="margin-top: 0px;"><span
onmouseout="setAuto()" onmouseover="clearAuto();Mea(3);"><a title="卡巴斯基 全功能安全软件2010(三年版)"
target="_blank" href="http://www.zol.com/detail/6/goods_f64fb5bd61088b47e5fa2e23d5a0bdf7.html">
卡巴斯基 全功能安全软件2010(三年版)</a></span></li></ul>
</div>

<script type="text/javascript">
var n = 0;
var obj = document.getElementById("show_text");
var fc = document.getElementById("fc");
function Mea(v) {
n = v;
setBg(v);
plays(v);
}
function setBg(v) {
for (var i = 0; i < 4; i++) {
if (v == i) {
obj.getElementsByTagName("li")[i].className = "act";
if (v == 3) {
obj.getElementsByTagName("li")[3].style.marginTop = "-2px";
} else {
var p = obj.getElementsByTagName("li")[3].style.marginTop;
if (p == "-2px") {
obj.getElementsByTagName("li")[3].style.marginTop = "0px";
}
}
} else {
obj.getElementsByTagName("li")[i].className = "";
}
}
}
function plays(v) {
try {
with (fc) {
filters[0].Apply();
for (var i = 0; i < 4; i++) {
(i == v) ? children[i].style.display = "block" : children[i].style.display = "none";
}
filters[0].play();
}
} catch (e) {
var d = document.getElementById("fc").getElementsByTagName("div");
for (var j = 0; j < 4; j++) {
(j == v) ? d[j].style.display = "block" : d[j].style.display = "none";
}
}
}
function clearAuto() {
clearInterval(autoStart);
}
function setAuto() {
autoStart = setInterval("auto()", 2000);
}
function auto() {
n++;
if (n >= 4) n = 0;
Mea(n);
}
setAuto();
</script>

</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值