object does not support this property or method 2146827850

S

stellstarin

hi all,
I have a HTML page with two forms.
While trying to add a hidden element in a first form by the default
javascript function, the error message 'object does not support this
property or method 2146827850'
Does any one know why this problem occurs?
 
R

RobG

(e-mail address removed) said on 25/04/2006 10:13 PM AEST:
hi all,
I have a HTML page with two forms.
While trying to add a hidden element in a first form by the default
javascript function,

What is 'the default javascript function'?

the error message 'object does not support this
property or method 2146827850'
Does any one know why this problem occurs?

Typically because you are attempting to use a method or property with an
object that doesn't support the method or property. Post a minimal
example that demonstrates the behaviour, then you'll get a more useful
response - maybe. ;-)
 
I

Ian Collins

RobG said:
(e-mail address removed) said on 25/04/2006 10:13 PM AEST:



What is 'the default javascript function'?




Typically because you are attempting to use a method or property with an
object that doesn't support the method or property. Post a minimal
example that demonstrates the behaviour, then you'll get a more useful
response - maybe. ;-)
Or load the page in FireFox and get a more meaningful error message...
 
R

Richard Cornford

Ian said:
Or load the page in FireFox and get a more meaningful error
message...

It is often repeated that IE's error messages are a bit too obscure (and
constantly getting the line numbers off doesn't help much) but it is
maybe a little unfair as IE is at least consistent and once you are used
to its errors you can know what to look for when a particular error
appears.

For example, when IE complains "Object expected" it invariable means
that an attempt was made to call a function with an Identifier that
evaluated as Undefined or Null. That is a compliantly reasonable error
to generate as only functions can be called and functions are a sub-set
of objects so when JScript discovers that a value is not a reference to
an object there is no need to go on to worry about whether that objet
has a [[Call]] method, it can stop at the realisation that the value is
not an object, and announce that.

Granted, JavaScript(tm)'s "'something' is not a function" is more
obvious, but you cannot debug IE specific script issues by trying code
that will take an entirely different branch in an alternative browser.
So learning to match IE's obscure messages with their causes is still a
good idea.

Richard.
 
I

Ian Collins

Richard said:
It is often repeated that IE's error messages are a bit too obscure (and
constantly getting the line numbers off doesn't help much) but it is
maybe a little unfair as IE is at least consistent and once you are used
to its errors you can know what to look for when a particular error
appears.
I agree, but having another tool in the box helps. I assumed the OP was
a novice and hadn't mastered the art of interpreting IE's error messages.
 
S

stellstarin

hi all,
as the question was not clear to all, i am posting the question once
again.

I have a HTML page with two forms.
While trying to add a hidden element in a first form by the default
javascript functions, like createElemet & appendchild.

function addField (form, fieldType, fieldName)
{
if (!document.createElement) return;
var oInput = document.createElement('input');
oInput.type = fieldType;
oInput.name = fieldName;
form.appendChild (oInput);
}

the error message 'object does not support this
property or method' with the error number 2146827850 was displayed
when the code was put inside a
try...catch...
Does any one know why this problem occurs?
 
V

VK

hi all,
as the question was not clear to all, i am posting the question once
again.

I have a HTML page with two forms.
While trying to add a hidden element in a first form by the default
javascript functions, like createElemet & appendchild.

function addField (form, fieldType, fieldName)
{
if (!document.createElement) return;
var oInput = document.createElement('input');
oInput.type = fieldType;
oInput.name = fieldName;
form.appendChild (oInput);
}

the error message 'object does not support this
property or method' with the error number 2146827850 was displayed
when the code was put inside a
try...catch...
Does any one know why this problem occurs?

Difficult to say without seeing the page or at least the function call
(what are you feeding to addField). Just out of wild: are you sure that
you're sending form reference and not a string with form name?
 
I

Ian Collins

hi all,
as the question was not clear to all, i am posting the question once
again.

I have a HTML page with two forms.
While trying to add a hidden element in a first form by the default
javascript functions, like createElemet & appendchild.

function addField (form, fieldType, fieldName)
{
if (!document.createElement) return;
var oInput = document.createElement('input');
oInput.type = fieldType;
oInput.name = fieldName;
form.appendChild (oInput);
}

the error message 'object does not support this
property or method' with the error number 2146827850 was displayed
when the code was put inside a
try...catch...
Does any one know why this problem occurs?
As I said, try FF, you will get the object name and line number in the
JavaScript console.

Is form a valid HTMLFormElement object?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top