473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Understanding 'Type mismatch' in IE

I have a constructor with this IE specific code in it:

this.doc.onreadystatechange = this.ready;

in a subsequent method I have:

alert(this.doc.readyState);
this.doc.onreadystatechange = null;

The alert displays 4 so it 'must' be recognising this.doc yet IE tells
me that the next line has Error: Type mismatch.

Could someone please explain why the error is occurring?

Andrew Poulos
Jan 6 '06 #1
3 20949
Andrew Poulos wrote:
in a subsequent method I have:

alert(this.doc.readyState);
this.doc.onreadystatechange = null;

The alert displays 4 so it 'must' be recognising this.doc yet IE tells
me that the next line has Error: Type mismatch.

Could someone please explain why the error is occurring?


I can't, but there is a bit about this on quirksmode:

http://www.quirksmode.org/blog/archi...notes_a_1.html

(see the heading 'Clear readystatechange!')

Not an explanation, but a workaround and some discussion.
Jan 6 '06 #2
VK

Andrew Poulos wrote:
I have a constructor with this IE specific code in it:

this.doc.onreadystatechange = this.ready;

in a subsequent method I have:

alert(this.doc.readyState);
this.doc.onreadystatechange = null;

The alert displays 4 so it 'must' be recognising this.doc yet IE tells
me that the next line has Error: Type mismatch.

Could someone please explain why the error is occurring?


Some IE versions do not allow you to "kill" event listener in such way.
Overall it's a very rude habit :-)

Use instead:

this.doc.attachEvent('onreadystatechange', myListener);
....
this.doc.detachEvent('onreadystatechange', myListener);

and
addEventListener / removeEventListener respectively for Firefox

Jan 7 '06 #3
VK

Andrew Poulos wrote:
I have a constructor with this IE specific code in it:

this.doc.onreadystatechange = this.ready;

in a subsequent method I have:

alert(this.doc.readyState);
this.doc.onreadystatechange = null;

The alert displays 4 so it 'must' be recognising this.doc yet IE tells
me that the next line has Error: Type mismatch.

Could someone please explain why the error is occurring?

Andrew Poulos


Or (much less academical but more universal and simple I guess) use an
event dumper:

function foo() {
/* NOP */
}
....
obj.onreadystatechange = someUsefulFunction;
....
obj.onreadystatechange = foo;

Jan 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
2
by: igor.barbaric | last post by:
Hello! I have created a very simple query like this: SELECT Tasks.Name, DurationHrs(,) AS Duration FROM Tasks INNER JOIN Log ON Tasks.TaskID=Log.TaskID; The above query works fine....
1
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
Oralloy
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 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.