2011-01-07 29 views
8
<td id="btnIcOld" style="text-align:center;"> 
    <img src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> 
</td> 

$('#btnIcOld').live('click', function() { 
    window.location.href = 'https://extranetint.chathamfinancial.com/indications/swapcalculator'; 
}); 

因此,您可以看到上面,圖像是我的按鈕,這是處理按鈕單擊的JQuery。問題是,當你將鼠標懸停在圖像上時,它仍然是基本的箭頭指針。如何讓它變成一隻手,讓用戶知道他們可以點擊它?使鼠標指針成爲手點擊按鈕

回答

15

您可以編輯該列的樣式爲cursor:pointer請參閱CSS cursor property

<td id="btnIcOld" style="text-align:center;cursor:pointer;"> 
    <img src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> 
</td> 
+1

真棒。你是男人。 CSS有這麼多! – slandau

1

您可以在您的CSS樣式中使用cursor:pointerSee here for some CSS Cursors

或者,有沒有辦法將它包裝在a標記中,指向您需要的鏈接?

+0

'cursor:hand;'在Mozilla和Chrome中不起作用,'cursor:pointer;' – Burjua

+0

@Burja感謝您的幫助。 –

1

改變光標的風格上面的圖片時:

<td id="btnIcOld" style="text-align:center;"> 
    <img style="cursor: pointer" src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> 
</td> 
0

每個人都是非常正確的,但我會建議那些分裂出去的風格可維護性。嘗試是這樣的:

的main.css:

.txtCenter { text-align:center; } 
.clickImage { cursor:pointer; } 

ASPX頁面:

<html> 
    <head> 
     ... 
     <link rel="stylesheet" href="path\to\main.css" type="text/css" /> 
    </head> 

    <body> 
     ... 

     <td id="btnIcOld" class="txtCenter"> 
      <img class="clickImage" src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> 
     </td> 

     ... 
    </body> 
</html>