I probably got a quite simple question. I generate some images using javascript. when i click on such an image and move the cursor the image should follow until i click again.
That is my solution:
I create the img and connect it with an "onclick" event handler:
img.onclick = prepare_pic_move(img);
This kind of handler starts the "onmousemove" handler:
function prepare_pic_move(img) {
img.onmousemove = pic_move(ev, img);
}
That function should finally move the picture:
function pic_move(ev, img) {
img.style.left = ev.ClientX;
img.style.top = ev.ClientY;
}
It does not work and the firefox bug console says that ev is not defined.
I think the problem is that i have to use two parameters at the pic_move function.
No comments:
Post a Comment