473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Trouble setting onmousedown in Firefox

randomfool
I'm having trouble setting an onmousedown function in firefox. It works fine in IE 7 but when I attempt to call the function in firefox I am getting an "event is not defined" error.

document.getElementById("statusbar").onmousedown = function (){enableResize(event, 'window')};

I tried using

document.getElementById("statusbar").addEventListe ner("mousedown", function (){enableResize(event, 'window')}, true);

but that didn't seem to work correctly either. Does anyone know how I can accomplish this? Thanks!

-Ryan
Jun 1 '07 #1
6 12711
mrhoo
428 256MB
"event is not defined" error
Pay attention to error messages- they can solve your problems.
This one tells you that event was called without being defined.
IE has a global event, but firefox does not, unless you provide one.

document.getElementById("statusbar").onmousedown = function (){enableResize(event, 'window')};
Jun 1 '07 #2
So how would I go about defining the event for firefox?

I was under the impression that using

document.getElementById("titlebar").addEventListen er("mousedown", enableDrag(event, 'window'), true);

would create the event and should solve the problem. I'm a bit lost when it comes to events.

The actual script is here: http://www.randomfool.net/emprise
Jun 2 '07 #3
dmjpro
2,476 2GB
I think window.event object is defined for each browser.
If addEventListener is not working then try with attachEventListener.
Best of luck.

Kind regards,
dmjpro.
Jun 2 '07 #4
ronnil
134 Expert 100+
When exactly does the onmousedown don't occur? my FF seems to have no problem dragging your div around. (until i close it and reopen it), but no error fires.
Jun 2 '07 #5
What's happening is when I maximize the window to fill the screen I remove the drag and resize functions so you can't change the window. When the window is then restored to it's previous size/position I I'm trying to reenable the dragging and resize functions. which was causing the error and now appears to do nothing. I can't check the code right now so I'm not sure what I broke.


What's happening when you close in reopen the window? One of my friends told me he had trouble dragging vertically when he reopened the window but I couldn't get that to happen when I was playing with it.

Dragging is also kinda messed up as I haven't quite figured out how to reposition the status bar to the bottom of the window correctly yet.
Jun 2 '07 #6
Well I finally figured it out. It turns out I just needed to add event to the function () { ...} call and it worked.

document.getElementById("titlebar").addEventListen er("mousedown", function (event){enableDrag(event, 'window')}, true);

Thanks for all the replies! The working version is at: http://randomfool.net/window/


-Ryan
Jun 3 '07 #7

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

Similar topics

1
by: sameth | last post by:
I wrote a script that uses onmousedown and onmouseup in javascript that works great in ie and firefox on windows2000. It looks as if the pocketpc 2003 ie browser dosn't support onmousedown or...
3
by: weston | last post by:
I'm making a foray into trying to create custom vertical scrollbars and sliders, and thought I had a basic idea how to do it, but seem to be having some trouble with the implementation. My...
3
by: walkerfx | last post by:
Hi All, Is there a way to access the value assigned to onmousedown for an object? I've been searching online but can only seem to find how it is assigned via html. What I need to do is access...
3
by: atn2002 | last post by:
I'm trying to create a control which when the mouse button gets pressed on one div an absolute positioned div pops up in place of the cursor. From there the cursor should interact with the dialog...
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
12
by: rhino | last post by:
I'm having some problems with Sliding Doors, as described in an article in A List Apart (http://www.alistapart.com/articles/slidingdoors/) and as detailed in the CSS Tab Designer v2.0 program. ...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.