473,473 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

this == document

25 New Member
how do you test if this is a reference to document?
this==document fails
Sep 27 '09 #1
6 1735
Markus
6,050 Recognized Expert Expert
this === document ?

Not sure.
Sep 27 '09 #2
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. test == document
worked for me.

another test would be
Expand|Select|Wrap|Line Numbers
  1. obj.toString().indexOf("HTMLDocument") != -1
Sep 27 '09 #3
byteit101
25 New Member
Oops! I have two documents, on inside an iframe in one. is there a way to see if it is a Document? (typeof this returns object, I need to be more specific)
Sep 27 '09 #4
Dormilich
8,658 Recognized Expert Moderator Expert
see above


________________
Sep 27 '09 #5
rnd me
427 Recognized Expert Contributor
duck type it:
Expand|Select|Wrap|Line Numbers
  1. if (this.body && this.getElementsByTagName ){
  2.   alert("this quacks like a document!");
  3. }
Sep 28 '09 #6
Dormilich
8,658 Recognized Expert Moderator Expert
@rnd me
there are cases possible, where this is also true for custom objects (so take care of what you duck tape)
Sep 28 '09 #7

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

Similar topics

3
by: Rosinger | last post by:
Hi all, What is the preferred in term of browser copatability to get a reference to an element in the document in JavaScript? I am not sure about when to use document.all or document.layers or...
1
by: chirs | last post by:
Hi, Is there a difference between document.tagID and document.all.tagID. I've seen both like: document.myImage1.src = "nextImage2.jpg" and document.all.hot1.style.color= ... where hot1 is in...
3
by: Gary Mayor | last post by:
Hi, I'm re phrasing and earlier question as the earlier question doesn't make to much sense. I using document.onmousemove to move a <div line on the screen. At the moment if I click and move the...
7
by: Fendi Baba | last post by:
The function is called from opencalendar(targetfield). Thanks for any hints on what could be the problem. .............................................................. var...
10
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the...
9
by: alu | last post by:
Could someone explain the discrepancies within and between the stated definitions / usage of 'document.location' , 'document.URL' vs. their actual functionality? Should they be read-only when in...
2
by: Gulliver | last post by:
Gurus please help! Using VB.net I would like to do the following: 1. Open up a doc or rtf file in my application 2. Search through the text using keywords 3. Select portions of the text by...
13
by: RommelTJ | last post by:
Hi, My website (http://www.justiceinmexico.org/indextest.php) looks good in Firefox, but horrible in IE, and I think it's because of an error in the javascript of a free web ticker I got off the...
8
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
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...
0
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...
0
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...
0
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 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.