2011-01-07 6 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:pointer를 사용할 수 있습니다. See here for some CSS Cursors

또는 a 태그에 포장하여 필요한 링크를 가리키는 방법이 없습니까? 이미지 위의

+0

Mozilla와 Chrome에서'cursor : hand;'가 작동하지 않습니다.'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> 
관련 문제