Solved (small popup) at current mouse position

Posted on 2003-11-30
Last Modified: 2012-06-22
I'm working on an .net page where I have a few date fields. I've got a button for each field where the user can open up a popup calender page. I would like the new window to open up where the button is pressed.
Question by:toederud
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

Christian_Wenz earned 50 total points
ID: 9844959
first, detect the mouse position:

var x, y;
window.onload = init;

function init() {
  if (window.Event) {
  document.onmousemove = getXY;

function getXY(e) {
  x = (window.Event) ? e.pageX : event.clientX;
  y = (window.Event) ? e.pageY : event.clientY;

then open the window and move the window to the mouse position:

<input type="button" onclick="openWin()" value="click me" />

function openWin() {
  var w ="page.html", "xy", "options");
  w.moveTo(x, y);


Author Comment

ID: 9845003
This works fine in IE and NS but what changes can be made to make it work in Opera?

Author Comment

ID: 9845164
I get an error on the document.captureEvents(Event.MOUSEMOVE); line in Opera.

Since I live in Norway and many off the sites users use Opera it is esential that this works in Opera.

Expert Comment

ID: 9850004
Opera uses window.captureEvents(Event.MOUSEMOVE), so you might check for that:

if (window.Event) {
    if (document.captuerEvents){
    } else {

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Geolocation works...sometimes 2 36
Expanding/Collapsing Tree on SharePoint List 29 62
object method as an event handler 8 73
jQuery element reference issue 2 38
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question