PDA

View Full Version : var ns6=document.getElementById && !document.all



okerix
06-24-2010, 04:13 PM
1) Script Title: Cool DHTML tooltip

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm

3) Describe problem: The script works great no issues there. It really deals with the way I'm implementing it. I am using some software to create some web based training and using the tooltip for glossary word descriptions. Well the software I use uses a third party editor for the code called fckeditor(sucks). On some pages(not sure why not all thats why this thing is finicky) but the script will break the images on the page. So the tooltip works but my images are broke. Found out it's because of less than symbols and the && operator. I modified the script of all those operators to work so far except for one line:

var ns6=document.getElementById && !document.all

I'm still learning and I'm not sure what this line means. I know the first part but don't get the && !document.all part. Does anyone know a way to make this line without the && and if not maybe explain what this line is doing? Any help is appreciated.
Thanks,
Shaun

jscheuer1
06-24-2010, 04:25 PM
&& means logical and. The ! means not. As to what the line is doing, it is browser sniffing, trying to determine what browser is viewing the page. Doing it this way isn't real good, but there are far worse ways. I don't think you can get rid of the && without making it more than one line. But that's OK, right? Here you go:


var ns6 = document.getElementById;
if(document.all){
ns6 = false;
}

okerix
06-25-2010, 02:56 PM
You rock jscheuer1!! That was the last line I needed to fix. Now with your help I have beat this stupid editor. I hope you have a super day!