View Full Version : if NS6 or IE

06-14-2012, 09:24 PM
I’m using the tooltip scripts from:


The main entry function for displaying the tip is:

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
return false

This code runs file on IE8 and FF12. It defiantly executes the code inside the test for NS6 and IE, I changed the innerHTML to set it to “Yabba Dabba Doo” and all the tips came up with that phrase.

How does FF know it is NS6 or IE so it can execute the code? Is the if statement really necessary?

06-14-2012, 09:49 PM
You have only posted part of the script. The ns6 and ie values are being set elsewhere in the script.

That it is doing that at all indicates that what you have is an antiquated script that should have been completely rewritten about five years ago - presumably the ie is referring to IE4 since if the ns6 test is set up correctly it would include IE5+.

As far as that particular piece of code is concerned you can simply remove the if statement and run the code within it all the time. Presumably tipobj is incorrectly defined as a global object as otherwise the script wouldn't work.

The rest of the script probably needs similar minor changes to get rid of the worst of the antiquated unnecessary code and a complete rewrite to fix all the other potential problems.

06-15-2012, 02:39 PM
Duh, anther old age brain #@&!

Sorry for wasting everyone's time.

By the way, the script works great. I'll post the page I'm using it for as soon as it is ready.