473,748 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strange "Object doesn't support this property or method" problem

I have a frameset page witch contains the myFuc() function. The
function is accessed from a page in one of the frames in the frameset.
An example is shown below.

<input onclick="javaSc ript:alert('doc ument.forms(0)= '+document.form s(0));
parent.myFunc(d ocument.forms(0 ));" type="button" value="Open"
name="Button" ID="Button">

The strange part is that the debug alert says that the
document.forms( 0) is an object så all seem to be well. But directly
afterwords when parent.myFunc(d ocument.forms(0 )) is to execute, the
page halts with the "Object doesn't support this property or method"
error message.

How can it be allright first and then not?

/Olaf
Jul 23 '05 #1
2 8925
Olaf wrote:
I have a frameset page witch contains the myFuc() function. The
function is accessed from a page in one of the frames in the frameset.
An example is shown below.

<input onclick="javaSc ript:alert('doc ument.forms(0)= '+document.form s(0));
parent.myFunc(d ocument.forms(0 ));" type="button" value="Open"
name="Button" ID="Button">

The strange part is that the debug alert says that the
document.forms( 0) is an object så all seem to be well. But directly
afterwords when parent.myFunc(d ocument.forms(0 )) is to execute, the
page halts with the "Object doesn't support this property or method"
error message.

How can it be allright first and then not?

/Olaf


Are you sure it isn't parent that doesn't support myFunc().

Try alert(parent.my Func);

Also, the proper notation for collections in Javascript is using square
brackets. Curved brackets (braces) may work in Internet Explorer, but it will
break in any other browser. So use document.forms[0] rather then
document.forms( 0)

And you don't need the "javascript :" label in events unless you've defined
your first script block as <script language="VBScr ipt">.

And you don't need to refer to the form using the complete DOM hierarchy if
it's the same form the current element resides in, because each form element
has a property "form" which refers to it's parent form.

So putting it all together...

<input onclick="alert( parent.myFunc); /* parent.myFunc(t his.form); */"
type="button" value="Open" name="Button" ID="Button">

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2
Olaf wrote:
I have a frameset page witch contains the myFuc() function. The
function is accessed from a page in one of the frames in the frameset.
An example is shown below.

<input onclick="javaSc ript:alert('doc ument.forms(0)= '+document.form s(0)); [1]^^^^^^^^^^^ [2]^^^^^^^^^^^^^^^ ^

[1] Remove that, see the FAQ: <http://jibbering.com/faq/>

[2] document.forms as of the still proprietary, yet widespread, DOM
Level 0 (IE/NN 3+) is a collection, a special object, not a method
(it is now defined as Document.forms HTMLCollection object in the
W3C DOM as well, however `document' is apparently still
proprietary). Use the square bracked property accessor of
ECMAScript, in called the "index operator" in J(ava)Script:

document.forms[0]

BTW: Has it ever occurred to you that client-side scripting
may be disabled and thus the button will do nothing then?
parent.myFunc(d ocument.forms(0 ));" type="button" value="Open"
name="Button" ID="Button">

The strange part is that the debug alert says that the
document.forms( 0) is an object så all seem to be well. But directly
afterwords when parent.myFunc(d ocument.forms(0 )) is to execute, the
page halts with the "Object doesn't support this property or method"
error message.

How can it be allright first and then not?


All I can say for sure is that strange syntax often causes strange
behaviour. In your case, document.forms( 0) is first used as substring
in a concatenation operation, which would require its value to be
converted to a string prior, using the toString() method on it
internally. However, using the same term as argument for your
function causes it to be evaluated as an object reference. A proper
DOM and script engine would have yield an error like "document.f orms
is not a method" in both cases as the call operator (the parantheses)
was used for a non-function property. However, the IE DOM is known
to allow this ambiguity for its host objects: elements of some,
possibly all, collections can be accessed both via the call and the
index operator, the collections being apparently both function and
non-function properties. And the error message you have reported
suggests that you are testing with IE (which you should have reported, too).
PointedEars
Jul 23 '05 #3

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

Similar topics

4
13768
by: KathyB | last post by:
I have the following script in an html page: function goToPosition() { varGoTo = document.write(document.cookie("Position")); document.scrollTo(0, varGoTo); } </head> <body onload="goToPosition()">
2
3797
by: SmittyBroham | last post by:
Hello, I have a function that loops through 2 select lists and records the values of any hi-lighted options a user would have selected. It then sets 2 corresponding "hidden" form elements to the values and submits the form data to the server. I was error free until I added the following line: document.myform.submit();
4
14157
by: Otis Hunter | last post by:
I have been fighting with this for days and your expert help is needed! Below is the code I am executing which results with "Object doesn't support this property or method". The error is occuring on the "With Me.OLEObject" line (By the way, I haven't found documentation which explains what the "With" clause is suppose to do?). I am trying to extract a Word document(OLE object) from an Access database, for each record in the table, and...
2
631
by: todd | last post by:
Hi all. I inherited this code from a contractor. It is a .NET user control that runs on the client side (ie) on machines with the framework installed. I have been mucking around to get it work for a couple of days now, and am growign really frustrated. I need to expose an Import method on the ImportControl and have it accesible to javascrip in the browser. If I remove the InterfaceType and ClassInterface attributes, compile and then...
5
2968
by: monu121 | last post by:
hi, i am getting one error "Object Does Not Support This Property or Method..." when i am using my dll file actuly i am calling my dll file in product. i am using vb 6.0. if any one is knowing about this so plz help me. thanks & regards monu121
1
2074
by: hhackwell | last post by:
Hi guys, I'm running a simple piece of Javascript on my website to allow users to make an object appear when they want to use it. It works fine but I keep getting this error on IE and although it still works I'd like to figure out what it's referring to so I can get rid of it: "Object doesn't support this property or method" Here is my code:
1
3404
by: chetan7991 | last post by:
I'm using a jquery plugin Galleriffic in my page and it shows perfectly in all browsers except IE. The error says: "Object doesn't support this property or method" The code I use for script activation is: <script type="text/javascript"> $(document).ready(function() { var gallery = $('#thumbs').galleriffic({ delay: 3000, // in milliseconds numThumbs: 2, // The number of thumbnails to...
2
7238
by: simeric | last post by:
Hi all experts, I've "object doesn't support this property or method" error when running a Javascript on Internet Explorer 8 This is the statement that is having the error:- this.nodes=(node.obj.draw(0,0,this.getp(node,"width","100%"),0,this.getp(node,"bgcolor",0),0,(1000-this.num),this.getp(node,"div_class",0),s)); } Please kindly advise on this error can be fixed please Thank you very much
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3309
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 we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.