Member Avatar for jaimca

I need a java script code tat changes the mouse pointer to an image of my choice when a button or an image is clicked ..
Please help me out

regards jai..

Member Avatar for serkan sendur

document.style.cursor = "cursorTypeName";

Member Avatar for kylegetson

You can also do this via css and ajax. I do it this way, so i can create a few simple classes for my cursors, and then just use addClass or removeClass whenever an event occurs that I need to change the cursor (click, hover, alert, etc.)

Member Avatar for serkan sendur

dont worry most users with one posts are of "post and run" type. he will probably never come back, and when he wants to come back, he will create another user as he already forgot his credentials.

Member Avatar for jaimca

thanks a lot dude.. Your idea helped me..

Member Avatar for serkan sendur

please mark as solved.

Member Avatar for kuppa

give id for the image in html page,
in script get the id of the image as

var cus= document.getElementById("id_name");
cus.style.cursor="arrow";
cus.style.cursor="hand";

e.t.c use can u any of style which u want

that id_name is nothing but id of the image in html

:)

Member Avatar for serkan sendur

mark the damn as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.