I'm writing some image maniplation tools for a web application and I need the user to be able to select an area in an image by drawing a rectangle on it in a browser. I know I can get the position of the mouse and send that information to the server, but i'd like to be able to see the rectangle as it is described, which requires real time drawing in response to mouse movement. Any ideas on how I can do this in javascript? Or even not in javascript? All help is much appreciated.