Hello friends,
i have written following line of code in javascript for event handler but it works fine with IE but not works with Firefox
it get stuck on "attachevent" - addScrollSynchronization(divHeaderColumn, divContent, "vertical");
-
-
function addScrollSynchronization(fromElement, toElement, direction) {
-
removeScrollSynchronization(fromElement);
-
-
fromElement._syncScroll = getOnScrollFunction(fromElement);
-
fromElement._scrollSyncDirection = direction;
-
fromElement._syncTo = toElement;
-
toElement.attachEvent("onscroll", fromElement._syncScroll);
-
}
-
-
// removes the scroll synchronization for an element
-
function removeScrollSynchronization(fromElement) {
-
if (fromElement._syncTo != null)
-
fromElement._syncTo.detachEvent("onscroll", fromElement._syncScroll);
-
-
fromElement._syncTo = null;
-
fromElement._syncScroll = null;
-
fromElement._scrollSyncDirection = null;
-
}
-
anybody know any solution plz let me know
6 8803
Hello friends,
i have written following line of code in javascript for event handler but it works fine with IE but not works with Firefox
it get stuck on "attachevent"
addScrollSynchronization(divHeaderColumn, divContent, "vertical");
function addScrollSynchronization(fromElement, toElement, direction) {
removeScrollSynchronization(fromElement);
fromElement._syncScroll = getOnScrollFunction(fromElement);
fromElement._scrollSyncDirection = direction;
fromElement._syncTo = toElement;
toElement.attachEvent("onscroll", fromElement._syncScroll);
}
// removes the scroll synchronization for an element
function removeScrollSynchronization(fromElement) {
if (fromElement._syncTo != null)
fromElement._syncTo.detachEvent("onscroll", fromElement._syncScroll);
fromElement._syncTo = null;
fromElement._syncScroll = null;
fromElement._scrollSyncDirection = null;
}
anybody know any solution plz let me know
Please maintain the Code Tags while you do Post.
Look, attachEvent does not work in Firefox.
use addEventListener. -
toElement.addEventListener("scroll", fromElement._syncScroll,true);
-
fromElement._syncTo.removeEventListener("scroll", fromElement._syncScroll,true);
-
I think it will work.
Kind regards,
Dmjpro.
Please maintain the Code Tags while you do Post.
Look, attachEvent does not work in Firefox.
use addEventListener. -
toElement.addEventListener("scroll", fromElement._syncScroll,true);
-
fromElement._syncTo.removeEventListener("scroll", fromElement._syncScroll,true);
-
I think it will work.
Kind regards,
Dmjpro.
THANKS Dmjpro
but still i am getting error in other line - divContent.parentElement.style.width = divContent.offsetWidth + headerRowsWidth;
-
it says that divContent.parentElement. has no properties
if u know plz suggest
anyway thanks
THANKS Dmjpro
but still i am getting error in other line
divContent.parentElement.style.width = divContent.offsetWidth + headerRowsWidth;
it says that divContent.parentElement. has no properties
if u know plz suggest
anyway thanks
THANKS
Dmjpro
I GOT it now it is not showing error but it is not working
THANKS Dmjpro
but still i am getting error in other line
divContent.parentElement.style.width = divContent.offsetWidth + headerRowsWidth;
it says that divContent.parentElement. has no properties
if u know plz suggest
anyway thanks
Hey!
I already told you to use Code Tags. -
divContent.parentNode.style.width = divContent.offsetWidth + headerRowsWidth + "px";
-
//Do this I think it will work.
-
Best of Luck.
Kind regards,
Dmjpro.
acoder 16,027
Recognized Expert Moderator MVP
dotcom, the lesson here is to test in standards-compliant browsers such as Firefox or Opera first, then test in IE. attachEvent is IE-only and does not work in other browsers. addEventListener is the standard method and is supported by the rest of the modern browsers, but not IE. See this article.
The same applies to parentElement and parentNode. The difference here is that parentNode will work in all browsers.
acoder 16,027
Recognized Expert Moderator MVP
Changed the thread title to better describe the problem. Please use a good thread title. Also use code tags when posting code.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bert |
last post by:
Hello,
I'm having some problems with creating a script that works on both
Mozilla browsers as IE.
I want to change the background color of textareas and input text
fields as soon as somebody...
|
by: jiayanxiang |
last post by:
Hi:
I used the following code to dynamically add a control and I tried to
use attachevent to add a onClick event to the control. It doesn't seem
to do anything. Any idea what might be wrong?
...
|
by: zeg37 |
last post by:
Hi,
I am working with a Microsoft Data Page where the records are filtered
by two dates the user selects prior to any records being loaded. After
selecting dates they click on a button (BtnGo)...
|
by: luco |
last post by:
Hi!
I'm having a problem with attachEvent function. I'd like to add
attachEvent dynamically to some objects so that each could execute
event function with different parameter value. The question...
|
by: Peter Michaux |
last post by:
Hi,
Today I have been testing the event models from Netscape 4.8 and IE 4
to the current crop of browsers. I'd like to write a small event
library similar in purpose to the Yahoo! UI event...
| |
by: J |
last post by:
I am having problems dynamically adding more than one event handler to
an input. I have tried the Javascript included at the bottom. The
lines
inp.attachEvent('onkeyup',...
|
by: comicgeekspeak |
last post by:
Hi there,
I am trying to write a loop that will add 10 divs to the screen. Each
div will have an onclick event. The function that will be called
onclick requires a parameter. That parameter...
|
by: SkyZhao |
last post by:
if i use AttachEvent like this,it can't work;
eg:
var img = document.createElement("img");
img.attachEvent("onclick",alert("test"));
var div = document.createElement("div");...
|
by: Max |
last post by:
Hi All,
I need to check if attachEvent was done to an element. The problem is
that attachEvent does not save this information anywhere. Is there
any
way to do this???
Thanks,
Max
|
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,...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |