2010-03-02 70 views
0

我使用下面的代碼來定位上的按鈕頂部的圖標:添加圖標,形成按鈕

<a href="https://stackoverflow.com/users/hide_profile" class="button"> 
     <span class="hide_profile">hide public profile</span> 
    </a> 

a.button{ 
    background-image: url('/images/button.gif'); 
    display:inline-block; 
    position: relative; 
    _display: inline; 
    color:#888888; 
    font-weight:bold; 
    height:30px; 
    line-height:29px; 
    margin-bottom:14px; 
    text-decoration:none; 
    width:191px; } 
a:hover.button{ color:#0066CC; } 

.hide_profile{ 
    background-image: url('/images/icons/hide.png'); 
    background-repeat: no-repeat; 
    background-position:7px 6px; 
    font-size: 14px; 
    text-indent:30px; 
    display:block; 
} 

我使用Ruby on Rails的,我想知道如何爲一個表單提交做到這一點按鈕。有任何想法嗎?

回答

0

你可以做

 
<input type="image" 
     src="url-where-your-image-lives" 
     onclick="Element.up(this, 'form').submit()"> 

這裏假設你正在使用Prototype JavaScript庫,這似乎是有可能的,因爲你使用的回報率。