由於我回到繪圖板並重新開始,組織職位被刪除。我的新代碼做我想要的一切,但我確定它可以做更多。我希望這可以幫助其他PPL :)帶滾動條的Javascript滾動橫幅
<head>
<script>
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;
// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;
var Picture = new Array(); // don't change this
var Link = new Array(); // don't change this
var Left = new Array();
var Right = new Array();
Picture[1] = '1.jpg';
Picture[2] = '2.jpg';
Picture[3] = '3.jpg';
Picture[4] = '4.jpg';
Link[1] = "This is a One";
Link[2] = "This is a Two";
Link[3] = "This is a Three";
Link[4] = "This is a Four";
Left[1] = "<a href='#' onmousedown='changeLeftOne()'>Left 4</a>";
Left[2] = "<a href='#' onmousedown='changeLeftTwo()'>Left 1</a>";
Left[3] = "<a href='#' onmousedown='changeLeftThree()'>Left 2</a>";
Left[4] = "<a href='#' onmousedown='changeLeftFour()'>Left 3</a>";
Right[1] = "<a href='#' onmousedown='changeRightOne()'>Right 2</a>";
Right[2] = "<a href='#' onmousedown='changeRightTwo()'>Right 3</a>";
Right[3] = "<a href='#' onmousedown='changeRightThree()'>Right 4</a>";
Right[4] = "<a href='#' onmousedown='changeRightFour()'>Right 1</a>";
var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.getElementById) document.getElementById("CaptionBox").href= Link[jss];
if (document.getElementById) document.getElementById("LeftBox").innerHTML= Left[jss];
if (document.getElementById) document.getElementById("RightBox").innerHTML= Right[jss];
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
function resetTime() {
window.clearTimeout(tss);
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
function changeLeftOne() {
document.getElementById("LeftBox").innerHTML=Left[4];
document.getElementById("PictureBox").src="4.jpg";
document.getElementById("RightBox").innerHTML=Right[4];
jss = 4;
resetTime();
}
function changeLeftTwo() {
document.getElementById("LeftBox").innerHTML=Left[1];
document.getElementById("PictureBox").src="1.jpg";
document.getElementById("RightBox").innerHTML=Right[1];
jss = 1;
resetTime();
}
function changeLeftThree() {
document.getElementById("LeftBox").innerHTML=Left[2];
document.getElementById("PictureBox").src="2.jpg";
document.getElementById("RightBox").innerHTML=Right[2];
jss = 2;
resetTime();
}
function changeLeftFour() {
document.getElementById("LeftBox").innerHTML=Left[3];
document.getElementById("PictureBox").src="3.jpg";
document.getElementById("RightBox").innerHTML=Right[3];
jss = 3;
resetTime();
}
function changeRightOne() {
document.getElementById("LeftBox").innerHTML=Left[2];
document.getElementById("PictureBox").src="2.jpg";
document.getElementById("RightBox").innerHTML=Right[2];
jss = 2;
resetTime();
}
function changeRightTwo() {
document.getElementById("LeftBox").innerHTML=Left[3];
document.getElementById("PictureBox").src="3.jpg";
document.getElementById("RightBox").innerHTML=Right[3];
jss = 3;
resetTime();
}
function changeRightThree() {
document.getElementById("LeftBox").innerHTML=Left[4];
document.getElementById("PictureBox").src="4.jpg";
document.getElementById("RightBox").innerHTML=Right[4];
jss = 4;
resetTime();
}
function changeRightFour() {
document.getElementById("LeftBox").innerHTML=Left[1];
document.getElementById("PictureBox").src="1.jpg";
document.getElementById("RightBox").innerHTML=Right[1];
jss = 1;
resetTime();
}
function stopTime() {
(window.clearTimeout(tss));
}
</script>
</head>
<body onLoad="runSlideShow()" bgcolor="#FFFFFF;">
<div id="LeftBox"></div>
<a id="CaptionBox" href="T">
<div id="test2" onMouseOver="stopTime()" onMouseOut="resetTime()"> <img src="1.jpg" id="PictureBox" name="PictureBox" width="40" height="40"> </div>
</a>
<div id="RightBox"></div>
</body>
哇,我可以借用那臺時間機器嗎?我也想訪問1996年,好吧,認真的:我建議找到一個不同的起點,那就是真正糟糕的代碼。 (我可以自由地這樣說,因爲你說這不是你的。) – 2011-05-02 05:32:17