0

I'm trying to make a small script that changes CSS of the body and the cursor on the page to a cursor at a specified URL.

var cursorurl=prompt('Enter url of a image you want to use as a cursor on this page');
document.body.style.cursor="url("+cursorurl+"), auto;";

The javascript appears to be valid, but the cursor doesn't change. I'm assuming it has something to do with document.body.style.cursor="url("+cursorurl+"), auto;" and the parentheses, but if it is then I'm not sure how to do it properly.

  • Anything coming up in your console? Think you may have to use: document.body.style.cursor = "url(" + cursorurl + "), auto"; (notice "document" before "body") – Paul G Sep 28 '15 at 21:39
  • Also, ref: http://stackoverflow.com/questions/9408780/javascript-firefox-how-to-set-custom-cursor-from-local-png-file – Paul G Sep 28 '15 at 21:48
  • @PaulG No errors in the console. Tried using document.body instead of just body, still no result. – Chuck Fetch Sep 29 '15 at 15:07

0 Answers0