好吧我有一個JavaScript翻轉。我想在開始時選擇clicked3圖片,當我翻轉或翻轉其他圖片時,clicked3將被取消選擇。我的html中的圖片ID是:clicked1,clicked2,clicked3,clicked4。我已經完成了這段代碼,但它不起作用。看起來picture1翻轉不起作用,picture3沒有開始選擇...任何幫助?javascript onmouseover和onmouseout問題
window.onload=function() {
var domClicked1=document.getElementById("clicked1");
var domClicked2=document.getElementById("clicked2");
var domClicked3=document.getElementById("clicked3");
var domClicked3=document.getElementById("clicked4");
clicked1.call(domClicked1);
clicked2.call(domClicked2);
clicked3.call(domClicked3);
clicked4.call(domClicked4);
domClicked1.onmouseover=handleOver1;
domClicked2.onmouseover=handleOver2;
domClicked3.onmouseover=handleOver3;
domClicked3.onmouseover=handleOver4;
domClicked1.onmouseout=handleOut1;
domClicked2.onmouseout=handleOut2;
domClicked3.onmouseout=handleOut3;
domClicked4.onmouseout=handleOut4;
}
function clicked1(){
this.style.backgroundPosition = "0px top";
}
function handleOver1() {
this.style.backgroundPosition = "-198px top";
}
function handleOut1() {
this.style.backgroundPosition = "-198px top";
}
function clicked3(){
this.style.backgroundPosition = "-198px top";
}
function handleOver3() {
this.style.backgroundPosition = "-198px top";
}
function handleOut3() {
this.style.backgroundPosition = "0px top";
}
任何特別的原因,爲什麼你不使用jQuery的呢? –
導致我工作的代理人想要這樣..任何幫助? – alexkey89
我認爲你應該說服你的經紀人這是一個壞主意。 –