2
我目前有一個爲我的網站幻燈片放映,我試圖循環通過每個單選按鈕。我嘗試了多種方式,但似乎沒有任何工作。有人可以幫忙嗎?單選按鈕幻燈片
這裏是我的代碼:
/*This function is called when the window is done loading*/
window.onload = function() {
//Each of these buttons should call the Change Image Function, passing a differet parameter.
document.getElementById("button1").onclick = function(){
changeImage("formbackground1.jpg");
}
document.getElementById("button2").onclick = function(){
changeImage("formbackground2.jpg");
}
document.getElementById("button3").onclick = function(){
changeImage("background2.jpg");
}
}
var step=1
function slideit() {
document.images.slide.src=eval(document.getElementById("button"+step).onclick)
if (step < 3){
step++
}
else{
step = 1
setTimeout("slideit()", 2500)
}
slideit();
}
/*This function changes the picture when one of the 3 buttons is pressed*/
function changeImage(source) {
document.getElementById("myImage").src=source;
}
function popup(){
}
謝謝你這麼多。有效。我真的很感激它。我無法在任何地方找到它。 –