2014-04-26 45 views
1

如何使輸入按鈕在Onclick中處於活動狀態?如何在窗體元素中標記按鈕活動onclick

<div class="paForm-right"> 
    <form onsubmit="" name="form1" id="form1" method="post"> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-vk" value="Visitenkarten" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-briefbogen" value="Briefbogen" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-flyer" value="Flyer" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-faltblaetter" value="Faltblätter" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-einzelblaetter" value="Einzelblätter" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-plakate" value="Plakate" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-postkarten" value="Postkarten" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-prospekte" value="Prospekte" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-kataloge" value="Broschüren usw." name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-mappe" value="Mappe" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-buch" value="Bücher" name="submit" /> 
     <input type="submit" class="paForm-choose" id="paForm-bottom-calender" value="Kalender" name="submit" /> 
     <input type="hidden" name="value[Produkt]" id="senden" value="Detailanfrage" /> 
    </form> 
    <br /> 
</div> 

這是我的CSS ...但活躍的背景不工作...

input.paForm-choose:hover 
background-color:#D10C2D; 


#paForm-bottom-vk 
background-image:url(../Icon_Visitenkarte_HG-Trans.png); 

#paForm-bottom-vk:hover 
background-image:url(../Icon_Visitenkarte_HG-Trans.png); 


#paForm-bottom-vk:active 
background-image:url(../Icon_Visitenkarte_HG-active.png); 
+0

看起來你真的想有一個'' ... – salitola

回答

1

這裏是一個FIDDLE使用你的代碼,用的事實,我就把異常的「 #「在你的線路前面:主動。

The:active只顯示鍵被按下時,而不是當它被釋放時顯示。所以當你按住鍵時你可以看到米老鼠。

如果你有什麼改變,直到按下不同的鍵,你將不得不改變JS代碼。

CSS

#paForm-bottom-vk:active { 
background-image:url('http://i.imgur.com/1Xm81k2.jpg'); 
} 
+0

離開後顏色shoud顯示離開後關鍵...如何顯示js代碼? – salitola

+0

...該按鈕在離開密鑰後應該處於活動狀態。 – salitola

+0

但是,如果不點擊按鈕,則會跳轉到新頁面? – TimSPQR

相關問題