Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can I add a text box in run time in a position of mouse click on an image map like tagging an image in Facebook?

not a Pr-defined location

user-image
Question ajoutée par Mahmoud Manaa , Network Engineer , Zain - Kuwait
Date de publication: 2013/09/06
Houssem Gharsallah
par Houssem Gharsallah , Software Architect , NOMD Technologies

_ Use javascript onclick event to fire the click event. 

_ Use ajax to call the server side method and pass the x and y mouse coordinates as parameters

_ below an example of getting x and y coordinates of mouse

function readMouseMove(e){ x = e.clientX; y = e.clientY; }

document.onmousemove = readMouseMove; 

Daanish Rumani
par Daanish Rumani , Product Manager , Publicis Sapient

Steps:

  1. Add a a click event on either the image or on a transparent layer above it.
  2. Add a text box that is hidden by default.
  3. In the click event un-hide the text box and set its X and Y (i.e. top and left) co-ordinates based on the current mouse location. You can query the current mouse location.

Note: You may have to use some JavaScript.

More Questions Like This