0
這裏是我的問題,當我按下表單中的提交按鈕提交按鈕更改其圖像背景CSS。但是,當我使用mouseup將其圖像再次更改爲默認時,它不起作用。javascript表單提交更改提交按鈕圖像
JavaScript代碼
window.onload = searchInit;
function searchInit(){
document.getElementById('search_form').onsubmit = processForm;
document.getElementById('submit_s').onmousedown = submitImageChange;
document.getElementById('submit_s').onmouseup = submitImageDefault;
}
function processForm(){
var a = document.getElementById('search_text');
if(a.value.length > 0){
return true;
}else{
return false;
}
}
function submitImageChange(){
this.style.backgroundImage = 'url(\'../image/button_background.jpg\')';
}
function submitImageDefault(){
this.style.backgroundImage = 'url(\'../image/button_background2.jpg\')';
}
我希望你能幫助我..
謝謝