473,857 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code not working in Firefox and Opera

5,058 Recognized Expert Expert

I've created this little window that is shown when I roll the mouse over elements I specify in my html code.

Like a nubbin I test this in IE while I'me writing it, thinking it can hardly be that hard to modify for the other browsers when I'm done.

Now it works perfectly in IE but no matter what I do I can not make it work for Firefox or Opera.

Please, can anybody tell me what those !#"#$%%) browsers arn't understanding? :P

This is what I think is causing the problem.
Full code is here

Expand|Select|Wrap|Line Numbers
  1. ToolTip.prototype.Update = function()
  2. {
  3.     // Get mouse position
  4.     if (browser == "MSIE") {
  5.         // Internet Explorer (Also works for Opera)
  6.         MouseX = window.event.x+document.body.scrollLeft;
  7.         MouseY = window.event.y+document.body.scrollTop;
  8.         Width = document.body.clientWidth+document.body.scrollLeft;
  9.         Height = document.body.clientHeight+document.body.scrollTop;
  11.     } else {
  12.         // Netscape, (Firefox, Opera, ...)
  13.         MouseX = e.pageX;
  14.         MouseY = e.pageY;
  15.         Width = window.innerWidth+window.pageXOffset;
  16.         Height = window.innerHeight+window.pageYOffset;
  17.     }
  19.     // Get element
  20.     var element = $(ToolTip.elem);
  22.     element.style.visibility = "visible";
  23.     element.style.width = ToolTip.Width;
  24.     element.style.backgroundColor = ToolTip.backgroundColor;
  25.     element.style.border = "solid 2px "+ ToolTip.borderColor;
  26.     element.style.padding = "3px";
  27.     element.innerHTML = ToolTip.Text;
  28.     element.style.left = MouseX + 10;//(MouseX - parseInt(elemt.style.width.replace("px")));
  29.     element.style.top = MouseY;
  30. }
Panel that opens the ToolTip
onmouseover="ja vascript:ToolTi p.Show('What?') ;"
onmouseout="jav ascript:ToolTip .Hide();"
position: absolute;
left: 150px;
top: 50px;
ToolTip panel
visibility: visible;
position: absolute;
left: 300px;
top: 300px;
border: solid 2px red;"
Feb 1 '07 #1
25 4576
428 Contributor
ToolTip.prototy pe.Update = function()
should have the reference to the event parameter you use later.

MouseX = e.pageX;
MouseY = e.pageY;

IE doesn't use it, it uses a global event-
but include it for the clients that pass an event parameter:
ToolTip.prototy pe.Update = function(e)
Feb 1 '07 #2
5,058 Recognized Expert Expert
Ahh ofc thank you.

All this trouble cuz of a single e :P
Feb 1 '07 #3
16,027 Recognized Expert Moderator MVP
Like a nubbin I test this in IE while I'me writing it, thinking it can hardly be that hard to modify for the other browsers when I'm done.

Now it works perfectly in IE but no matter what I do I can not make it work for Firefox or Opera.

Please, can anybody tell me what those !#"#$%%) browsers arn't understanding? :P
That's the wrong way round. Test on a standards-supporting browser (pretty much any modern browser, but IE), then test on IE. IE is buggy and still fails to support standards properly.
Feb 1 '07 #4
5,058 Recognized Expert Expert
I'm not sure why ppl keep complaining about IE.

In my experience, IE is the one browser I've never had to re-write code for. But almost everytime I write a page I'm spending most of my time re-writing code for Firefox or Opera, depending on which one I use to test the original code.
99% of the time, if it works in either of them, it works in IE.

Also, IE has some nice features that no other browser is bothering to make.
The scrollbar-color styles for example.
And the smooth new look of all text in IE7.

In any case, if you want your code to work in any browser, do you want it to be IE, used by ~86% of the market, or any of the other 14%?

Btw. sry about the rant. All the MS haters out there are just really starting to annoy me, not that I'm saying your a MS hater, acoder :P
Feb 4 '07 #5
16,027 Recognized Expert Moderator MVP
Ok, have a good read on this topic. Plus some (many) IE7 bugs.
Feb 5 '07 #6
5,058 Recognized Expert Expert
Nice articles.

The first one had some usefull info.
Tho it looked like most of the problems it describes have been fixed in IE7.
O and omg! It's like the author went out of his way to created this page not to work with IE, and he did a good job!

The second one I liked a bit more.
Tho some of the bugs he demonstrated did really "work" when I tested them.
Im assuming that is because the author uses the Standalon version on Windows XP to spot them, I tried them using both IE7 on XP and IE7 on Vista.

Articles like these wont ever surprise me. I'm well aware that IE is buggy, but like the bullseye on Windows' back in security matters, the ammount of bugs and annoyance at IE is perhaps not because it is any more buggy than other browsers, but rather because there are alot more users to spot them.

Btw. Is it true that IE on Vista uses a new rendering engine, not the "dinosour" that has stayed with us since the browser wars?
Feb 5 '07 #7
16,027 Recognized Expert Moderator MVP
One of the main problems with IE is the amount of time taken to release patches when vulnerabilities are discovered. That is the reason why IE6 was simply not secure. Other browsers released patches almost immediately. That's for security, and if you're talking about bugs in rendering, DOM support, etc., you can forget it.

IE7 is a major improvement, but Microsoft really need to speed up bug fixes, patches, etc. otherwise we have the same problem. Btw, it is still based on Trident, but with improvements. See here unless you're talking about Spyglass (IE7 is the first IE not be based on Spyglass technologies).
Feb 5 '07 #8
5,058 Recognized Expert Expert
Yea, I won't argue with that.
My theory is that Bill Gates demands to read every line of code before it is released :P
Feb 5 '07 #9
143 New Member
Yea, I won't argue with that.
My theory is that Bill Gates demands to read every line of code before it is released :P
It's quite clear that you have absolutely no clue in regards to the Internet or the world wide web.

The "MS haters" out there, hate for a good reason. There's a group called the W3C that set the standards for the HTML specification and most of the browsers tend to try and follow this standard as closely as possible. Of course, there are some annoying quirks and differences, but worst of all, is InternetExplore r. Not only does it fail to follow standards, they even create their own. They agree to follow standards, yet don't implement them for more than 5 years. A great example is something as simple as PNG image support, which wasn't introduced until IE 7!!


The PNG specification was first issued as a W3C Recommendation on 1st October, 1996
There's a good reason that InternetExplore r is starting to lose it's monopoly of a markey share and that's because there are better alternatives out there, which display code more like it's supposed to be displayed and are also updated on a more frequent basis, making them safer from a security aspect and also more up to date.

Like you were already told - if you wish to create half decent web applications, code for standards compliant and modern browsers first, then tweak to get your code working with IE afterwards.
Feb 6 '07 #10

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

Similar topics

by: Boris | last post by:
Please open http://www.highscore.de/opera/floatleft.html in Opera 7.54 and Firefox 1.0 Preview. Who is right? In my humble opinion Opera 7.54 is right: According to CSS 2.1 a "floating box must be placed as high as possible" (see http://www.w3.org/TR/CSS21/visuren.html#float-position rule #8). Do you agree? BTW, Internet Explorer 6 behaves like Opera 7.54.
by: Sharon | last post by:
Can I use request.servervariables("HTTP_USER_AGENT") to determine if the user has Firefox or Internet Explorer? Is the return string differentiated enough? Thanks for any input.
by: mr_burns | last post by:
hi, i am using the following code which works well in internet explorer but not in firefox (and perhaps others too): var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.load("xml/names.xml"); nodes = xmlDoc.documentElement.childNodes span_html = '<p>'
by: Lachlan Hunt | last post by:
Hi, I've been looking up lots of documentation and trying to work out a cross-platform method of capturing a keyboard event and working out which key was pressed. From what I can find, there doesn't appear to be any standardised keyboard event interface other than this DOM 3 Events W3C Working Group Note . However, it is only a note and doesn't appear to be implemented in any browser. Is there another standard that I've missed? The...
by: warteschlange | last post by:
i want to postload javscript from another javascript. This works fine in firefox and IE6 for macIE i can use an Iframe to load the code and inject it with insertAdjacentHTML The problems arise with safari and opera. both load the new code with XMLHttpRequest, but the code is no 'executable' To make this possible on IE i had to use the magic 'DEFER' attribute.
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
by: jsreblev | last post by:
Hi Javascript gurus: I have tried several things, using several Javascript books, but can't get this to work in Netscape (latest version) and Firefox (latest v.). It works in MIE and Opera fine. A box (defined by a css layer) is supposed to pop out to the right when the corresponding box on the far left is moused over. The first function defines a layer id to the next function which pops out the box. After debugging in Venkman, it...
by: Noone Here | last post by:
AIUI, it was not all that long ago when the threat to personal users, was attachments that when executed compromised machines with keyloggers, trojans, etc. Now it seems that the big problem is reading a webpage or an HTML e-mail and getting affected through the scripting. My understanding is that the script downloads the malicious program from the web and sets it to run on start up through the start-up folder or in the registry. I...
by: Toby Inkster | last post by:
Does anyone have any idea why this effect using script.aculo.us is working in Opera, but not Firefox? http://examples.tobyinkster.co.uk/Balloons2/Balloon%20tooltip.html (I've not had the courage to even try it in IE yet!) Any ideas for a fix? Thanks
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.