$(function(){ $("#sample1box").mouseover(function(){ $(this).css({color:"black",background:"yellow"}).text("mouseover"); }); $("#sample1box").mouseout(function(){ $(this).css({color:"black",background:"green"}).text("mouseout"); }); $("#sample1box").mousedown(function(){ $(this).css({color:"white",background:"red"}).text("mousedown"); }); $("#sample1box").mouseup(function(){ $(this).css({color:"white",background:"navy"}).text("mouseup"); }); });
$(function(){ $("#sample2Box").mouseenter(function(){ $(this).css({color:"#1f8a76", background:"#f4721e"}).text("mouseenter"); }); $("#sample2Box").mouseleave(function(){ $(this).css({color:"#57bb4a", background:"#faaa34"}).text("mouseleave"); }); });
function s3Func(){ $("#s3Div").css({ width: "200px", height: "200px", background: "#798adc" }).mousemove(function(e){ var x = e.pageX - this.offsetLeft; var y = e.pageY - this.offsetTop; $(this).text("x:" + x + ",y:" + y); }); }