ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Mahmoud Manaa , Network Engineer , Zain - Kuwait
تاريخ النشر: 2013/09/06
Houssem Gharsallah
من قبل 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
من قبل 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.

المزيد من الأسئلة المماثلة