<!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>无标题文档</title>
<!--<style>
#eLore{width:800px;height:339px;position:relative;margin:0 auto;}
#eLore_wrap{width:800px;height:339px;position:relative;margin:0 auto;background:#39C;}
.eLore_out{position:absolute;top:0;width:120px;height:339px;overflow:hidden;background:#093;}
.eLore_img{position:absolute;top:0:width:120px;height:339px;overflow:hidden;}
</style>--><style type="text/css">
* { margin:0; padding:0; }
body {
margin:5px auto;
text-align:center;
background:#f0f0f0;
}
img { margin:0; border:0; padding:0; }
#eLore {
position:relative;
margin:0 auto;
width:800px; height:339px;
}
#eLore_wrap {
position:relative;
margin:0 auto;
overflow:hidden;
width:800px; height:339px;
background:#369;
}
#eLore .eLore_img {
position:absolute; top:0;
width:120px; height:339px;
overflow:hidden;
font-size:50px;
line-height:340px;
}
#eLore .eLore_out {
position:absolute; top:0;
width:120px; height:339px;
overflow:hidden;
font-size:10px;
line-height:340px;
}
</style>
</head><body>
<div id="eLore">
<div id="eLore_wrap">Loading...</div>
</div>
<script type="text/javascript">
//<[CDATA[
var eLore_wrap=document.getElementById('eLore_wrap');
var aImg=new array('112_jpg_thum.jpg','123_jpg_thum.jpg','112_jpg_thum.jpg', '123_jpg_thum.jpg');
var iImg=0;
var iA=0;
window.onload=function(){
eLore_createD();
}
function eLore_createD(){
if(iImg==10){
eLore_wrap.innerHTML= '';
iImg=0;
}
if(iImg==0){
eLore_wrap.innerHTML += '<div class="eLore_out" style="right:0px; background:url(' + aImg[iA] + ') -680px top no-repeat;">H</div>\n';
}
/*
var sDiv = '<div class="eLore_img" style="left:' + (720-iImg*80) + 'px; background:url(' + aImg[iA] + ') -720px top no-repeat;">' + iImg++ + '</div>\n';
eLore_wrap.innerHTML += sDiv;
*/
var oDiv=document.createElement('div');
oDiv.className='eLore_img';
oDiv.style.right=iImg*80+'px';
oDiv.style.background='url('+aImg[iA]+') -720px top no-repeat';
//oDiv.appendChild(document.createTextNode(iImg));
eLore_wrap.appendChild(oDiv);
iImg++;
eLore_move();
}
function eLore_move(){
var oDiv = eLore_wrap.getElementsByTagName('div');
for (var i=1; i<oDiv.length; i++) {
var iBgpx = parseInt(oDiv[i].style.backgroundPosition);
if (iBgpx<i*80-760) {
var iMovePx = Math.floor((760-i*80+iBgpx)/15);
oDiv[i].style.backgroundPosition = iBgpx - iMovePx + 'px top';
} else {
oDiv[i].style.backgroundPosition = '-' + (760- i*80) + 'px top';
}
}
if (iImg<10) {
setTimeout('eLore_createD()','50');
} else if (parseInt(oDiv[10].style.backgroundPosition)<40) {
setTimeout('eLore_move()','50');
} else {
iA = ++iA==aImg.length ? 0 : iA;
setTimeout('eLore_createD()','2000');
}
}
//]]>
</script>
<!--上下代码不同吗???-->
<!--<script type="text/javascript">
//<[CDATA[
var eLore_wrap = document.getElementById('eLore_wrap');
var aImg = new Array('112_jpg_thum.jpg','123_jpg_thum.jpg','112_jpg_thum.jpg', '123_jpg_thum.jpg');
var iImg = 0;
var iA = 0;
window.onload = function() {
eLore_createD();
}
function eLore_createD() {
if (iImg==10) {
eLore_wrap.innerHTML = '';
iImg = 0;
}
if (iImg==0) {
eLore_wrap.innerHTML += '<div class="eLore_out" style="right:0px; background:url(' + aImg[iA] + ') -680px top no-repeat;">H</div>\n';
}
/*
var sDiv = '<div class="eLore_img" style="left:' + (720-iImg*80) + 'px; background:url(' + aImg[iA] + ') -720px top no-repeat;">' + iImg++ + '</div>\n';
eLore_wrap.innerHTML += sDiv;
*/
var oDiv = document.createElement('div');
oDiv.className = 'eLore_img';
oDiv.style.right = iImg*80 +'px';
oDiv.style.background = 'url(' + aImg[iA] + ') -720px top no-repeat';
//oDiv.appendChild(document.createTextNode(iImg));
eLore_wrap.appendChild(oDiv);
iImg++;
eLore_move();
}
function eLore_move(){
var oDiv = eLore_wrap.getElementsByTagName('div');
for (var i=1; i<oDiv.length; i++) {
var iBgpx = parseInt(oDiv[i].style.backgroundPosition);
if (iBgpx<i*80-760) {
var iMovePx = Math.floor((760-i*80+iBgpx)/15);
oDiv[i].style.backgroundPosition = iBgpx - iMovePx + 'px top';
} else {
oDiv[i].style.backgroundPosition = '-' + (760- i*80) + 'px top';
}
}
if (iImg<10) {
setTimeout('eLore_createD()','50');
} else if (parseInt(oDiv[10].style.backgroundPosition)<40) {
setTimeout('eLore_move()','50');
} else {
iA = ++iA==aImg.length ? 0 : iA;
setTimeout('eLore_createD()','2000');
}
}
//]]>
</script>-->
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!--<style>
#eLore{width:800px;height:339px;position:relative;margin:0 auto;}
#eLore_wrap{width:800px;height:339px;position:relative;margin:0 auto;background:#39C;}
.eLore_out{position:absolute;top:0;width:120px;height:339px;overflow:hidden;background:#093;}
.eLore_img{position:absolute;top:0:width:120px;height:339px;overflow:hidden;}
</style>--><style type="text/css">
* { margin:0; padding:0; }
body {
margin:5px auto;
text-align:center;
background:#f0f0f0;
}
img { margin:0; border:0; padding:0; }
#eLore {
position:relative;
margin:0 auto;
width:800px; height:339px;
}
#eLore_wrap {
position:relative;
margin:0 auto;
overflow:hidden;
width:800px; height:339px;
background:#369;
}
#eLore .eLore_img {
position:absolute; top:0;
width:120px; height:339px;
overflow:hidden;
font-size:50px;
line-height:340px;
}
#eLore .eLore_out {
position:absolute; top:0;
width:120px; height:339px;
overflow:hidden;
font-size:10px;
line-height:340px;
}
</style>
</head><body>
<div id="eLore">
<div id="eLore_wrap">Loading...</div>
</div>
<script type="text/javascript">
//<[CDATA[
var eLore_wrap=document.getElementById('eLore_wrap');
var aImg=new array('112_jpg_thum.jpg','123_jpg_thum.jpg','112_jpg_thum.jpg', '123_jpg_thum.jpg');
var iImg=0;
var iA=0;
window.onload=function(){
eLore_createD();
}
function eLore_createD(){
if(iImg==10){
eLore_wrap.innerHTML= '';
iImg=0;
}
if(iImg==0){
eLore_wrap.innerHTML += '<div class="eLore_out" style="right:0px; background:url(' + aImg[iA] + ') -680px top no-repeat;">H</div>\n';
}
/*
var sDiv = '<div class="eLore_img" style="left:' + (720-iImg*80) + 'px; background:url(' + aImg[iA] + ') -720px top no-repeat;">' + iImg++ + '</div>\n';
eLore_wrap.innerHTML += sDiv;
*/
var oDiv=document.createElement('div');
oDiv.className='eLore_img';
oDiv.style.right=iImg*80+'px';
oDiv.style.background='url('+aImg[iA]+') -720px top no-repeat';
//oDiv.appendChild(document.createTextNode(iImg));
eLore_wrap.appendChild(oDiv);
iImg++;
eLore_move();
}
function eLore_move(){
var oDiv = eLore_wrap.getElementsByTagName('div');
for (var i=1; i<oDiv.length; i++) {
var iBgpx = parseInt(oDiv[i].style.backgroundPosition);
if (iBgpx<i*80-760) {
var iMovePx = Math.floor((760-i*80+iBgpx)/15);
oDiv[i].style.backgroundPosition = iBgpx - iMovePx + 'px top';
} else {
oDiv[i].style.backgroundPosition = '-' + (760- i*80) + 'px top';
}
}
if (iImg<10) {
setTimeout('eLore_createD()','50');
} else if (parseInt(oDiv[10].style.backgroundPosition)<40) {
setTimeout('eLore_move()','50');
} else {
iA = ++iA==aImg.length ? 0 : iA;
setTimeout('eLore_createD()','2000');
}
}
//]]>
</script>
<!--上下代码不同吗???-->
<!--<script type="text/javascript">
//<[CDATA[
var eLore_wrap = document.getElementById('eLore_wrap');
var aImg = new Array('112_jpg_thum.jpg','123_jpg_thum.jpg','112_jpg_thum.jpg', '123_jpg_thum.jpg');
var iImg = 0;
var iA = 0;
window.onload = function() {
eLore_createD();
}
function eLore_createD() {
if (iImg==10) {
eLore_wrap.innerHTML = '';
iImg = 0;
}
if (iImg==0) {
eLore_wrap.innerHTML += '<div class="eLore_out" style="right:0px; background:url(' + aImg[iA] + ') -680px top no-repeat;">H</div>\n';
}
/*
var sDiv = '<div class="eLore_img" style="left:' + (720-iImg*80) + 'px; background:url(' + aImg[iA] + ') -720px top no-repeat;">' + iImg++ + '</div>\n';
eLore_wrap.innerHTML += sDiv;
*/
var oDiv = document.createElement('div');
oDiv.className = 'eLore_img';
oDiv.style.right = iImg*80 +'px';
oDiv.style.background = 'url(' + aImg[iA] + ') -720px top no-repeat';
//oDiv.appendChild(document.createTextNode(iImg));
eLore_wrap.appendChild(oDiv);
iImg++;
eLore_move();
}
function eLore_move(){
var oDiv = eLore_wrap.getElementsByTagName('div');
for (var i=1; i<oDiv.length; i++) {
var iBgpx = parseInt(oDiv[i].style.backgroundPosition);
if (iBgpx<i*80-760) {
var iMovePx = Math.floor((760-i*80+iBgpx)/15);
oDiv[i].style.backgroundPosition = iBgpx - iMovePx + 'px top';
} else {
oDiv[i].style.backgroundPosition = '-' + (760- i*80) + 'px top';
}
}
if (iImg<10) {
setTimeout('eLore_createD()','50');
} else if (parseInt(oDiv[10].style.backgroundPosition)<40) {
setTimeout('eLore_move()','50');
} else {
iA = ++iA==aImg.length ? 0 : iA;
setTimeout('eLore_createD()','2000');
}
}
//]]>
</script>-->
</body>
</html>
这个你定义new Array() 当然不会有错误提示, 不过 Array的正确写法 在cs6里面是高亮的青色,凭这个特征判断就行了. 如果写出来是黑色 那就是自定义函数了. 当然有写扩展的dom操作方法在cs6里面好像也是黑色的,不过这些基本的 它还是都能识别出来的.