html - javascript to read mouse position and write to a file -
i trying coordinates of mouse pointer when clicked on image on html page, user has click on image , want coordinates of clicked position using javascript , write file on server itself. i'm using site44 host dropbox account. not able write coordinates file.
<html> <head> <title>image click test</title> <script type="text/javascript"> function coord() { var x; var y; x=event.offsetx; y=event.offsety; activexobject("scripting.filesystemobject"); var file = object.createtextfile("hello.txt",false); file.writeline(x); file.writeline("by"); file.writeline(y); file.close(); } </script> </head> <body onclick="coord()">this sample image, please click anywhere on image. ensure click once.<br> <img src="index_catfish.jpg" alt="click image" usemap="#imageclick"/> <map name="imageclick"> </map> </body> </html>
browser's js implementation can not write local files directly. way store info in cookies or in localstorage (if it's supported browser).
javascript html webpage
No comments:
Post a Comment