2
4

6 に答える 6

10

style="cursor:pointer"ハンドポインタとを追加する必要がありonclick="window.location='somewhere'"ます。

<div style="cursor:pointer" onclick="window.location='index.html'">My Link</div>
于 2013-03-05T05:37:39.833 に答える
2
var myel = document.querySelector('#myel'); // your element

myel.addEventListener('click', function() {
  // do stuff
});

CSSの場合:

#myel { cursor: pointer }
于 2013-03-05T05:38:24.607 に答える
2

あなたはそれをいくつかの方法で行うことができます。1つの方法は、cssで疑似クラスを割り当てることです。divにdiv1のクラスがある場合、cssは次のようになります。

.div1:hover{
    cursor:pointer;
}

javascriptでもできます

$('.div1').on("hover", function(){
    $(this).css("cursor", "pointer");
});
于 2013-03-05T05:39:40.997 に答える
1

お役に立てれば...

CSS

li:hover {
    cursor: pointer //on hover change the cursor to pointer
}

JQuery

$(document).ready(function() { 
    $("#click_me").bind("click", function(){ //bind a click event on an element with id = click_me
        $.ajax({ 
            url: "./file.txt", //note: file must be in the same domain as the current script http://en.wikipedia.org/wiki/Same_origin_policy
            dataType: "text",
            success: function(data) { //if ajax request is successful
                $("#result_container").html(data); //append the resulting data into a div with id = result_container
        }
    });
});

});

乾杯 :)

于 2013-03-05T07:26:00.050 に答える
1

cssを設定します。

ul li{
  cursor:pointer; /*  <------this will change the cursor to hand cursor*/
}

およびjQuery:

$(function(){
   $('li').click(function(){
      alert('li clicked.');
   });
});
于 2013-03-05T05:39:14.057 に答える
1
        $("div").hover(function(){
        $(this).css('cursor','pointer')
});
于 2013-03-05T05:39:57.580 に答える