473,472 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Firefox: Dialog position problem

1 New Member
Hi All,

I'm trying to position a dialog at my mouse position in firefox.
I have one image control. On mouseover of image I call captureMouse() to get mouse position and after click on image I need to show the dialog with its topleft

corner exactly from my mousepointer (On image)

I did following work around

It goes well with IE

but has problems with firefox


Expand|Select|Wrap|Line Numbers
  1. if(window.Event && document.captureEvents)
  2.     document.captureEvents(Event.MOUSEMOVE);
  3.  
  4. document.onmousemove = captureMouse;
  5.  
  6. var calX;
  7. var calY;
  8.  
  9. function captureMouse(evt)
  10. {
  11.      if (!evt)
  12.         var evt = window.event||window.Event;
  13.  
  14.     if('undefined'!=typeof evt.pageX)
  15.     {
  16.         calX = evt.pageX;
  17.         calY = evt.pageY;
  18.     }
  19.     else
  20.     {
  21.         calX = evt.clientX + document.body.scrollLeft;
  22.         calY = evt.clientY + document.body.scrollTop;
  23.     }
  24. }
  25.  
  26. function goToCalendar(ctl1, ctl2, compareWithDate)
  27. {
  28. /// 
  29. /// Some other code
  30. ///
  31.  
  32. if(window.showModalDialog) // IE
  33.     calX = window.screenLeft + calX;
  34.     calY = window.screenTop + calY;    
  35.     settings = 'dialogTop=' + calY + 'px;dialogLeft=' + calX + 
  36.  
  37. 'px;help=no;center=no;dialogWidth=208px;dialogHeight=214px;status=no;resizable=no;scroll=no';
  38.               retValue = window.showModalDialog('Calendar/Calendar.aspx?value=' + secondValue, window, settings);
  39. }
  40. else // Firefox
  41.     calX = window.screenX + calX;
  42.     calY = window.screenY + calY;
  43.  
  44.     retval = window.open('Calendar/Calendar.aspx?value=' + secondValue, 'Choose Date', 'dialog=yes, left=' + calX + ',top=' + calY + ', minimisable=no, 
  45.  
  46. resizable=no,scrollbars=no,status=no,width=214,height=201,dependent,modal=yes');
  47. }
  48. }

In firefox the dialog is placed little bit above the control which is certainly not acceptable by my client

Thanks you guys

Jayvardhan Patil
Oct 24 '07 #1
1 2564
mrhoo
428 Contributor
screenY in mozilla returns the distance to the top of the window chrome,
screenTop in IE returns the distance to the top of the window content, below the toolbars.

you can get closer to the screenTop value with:
screenY+(screen.height-screen.availHeight)

screenX has the same behavior, although usually there are no toolbars on the left to offset the content.
Oct 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: John Lauwers | last post by:
Hello, Is there a way to move the commondialog to a specific position ? Greets John
4
by: Schraalhans Keukenmeester | last post by:
I have no clue why below code (found it somewhere and altered it a wee bit to my needs) will run without problem in both IE and Mozilla FireFox 1.0 but in the latter it takes up close to 100% cpu....
3
by: Rod | last post by:
I have an asp.net application where some of the interaction with the user is through modal dialog windows. This works very well except for the annoying fact that the dialog window always returns...
4
by: TheCeej | last post by:
I'm sorry to post what is ultimately a myspace problem, but I'm sure I'd still be having this problem with any html/css document, so the answer would more than likely be able to help anyone out. I'm...
4
by: Steve | last post by:
I thought that this was available for all elements in Firefox, but recently had a page where a div didn't have it. I put in an id style for it, thinking that would do the trick, but it didn't. ...
2
by: agbee1 | last post by:
Hello: I've finally made the effort to ween myself from overly using tables and use CSS for my positioning. However, I am having a problem with my navigational menu properly aligning in Firefox,...
4
by: sbettadpur | last post by:
hello, i have created one website using div i.e total layout is designed using div only. if i saw that pages in Internet Explorer vesion 6, its showing very fine, but if i open same pages in...
1
by: vinya | last post by:
<html> <head> <script type="text/javascript"> var element; function test(){ abc = document.getElementById('promptbox').value; document.forms.elements.value = abc; ...
3
by: Steve | last post by:
Hi All I have an asp.net 2.0 website with the following css file It uses Master pages and in Firefox 3.04 for windows only, 3 of the web pages don't display the Master page properly The...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.