$(document).ready( function() { $("#memo").click(function(e){ var cx=e.clientX; var cy=e.clientY; if(cx<x)y=y+100; if(cx>x)x=x+100; sample(); }); });