473,654 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prototype prob

I have set up a 'class' using the prototype prop.

I pass the constructor a html tag children object and set 'this.obj = obj'.
When calling the first method of the class using the object it works fine.
However, when calling any second method using the object i get an error.
When debugging(alert ing) I am told that in the second method 'this.obj' is
undefined.
I have tried changing the class to call different methods first, and the
result is the same:
first methodcall works fine, later calls to other class methods result in
errors.

It seems the first 'this.obj' instance is acceptable, later ones are not...

I dont get it...

Any ideas ?

--
http://home.online.no/~oeyvtoft/ToftWeb/


Jul 23 '05 #1
4 995
On Sat, 28 Aug 2004 02:05:00 +0200, oeyvind toft wrote:
Any ideas ?


Supply URL.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
Sorry, not out there yet...
Its a big ugly script in the making...

Oeyvind

--
http://home.online.no/~oeyvtoft/ToftWeb/

"Andrew Thompson" <Se********@www .invalid> skrev i melding
news:r0******** *************** *****@40tude.ne t...
On Sat, 28 Aug 2004 02:05:00 +0200, oeyvind toft wrote:
Any ideas ?


Supply URL.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Jul 23 '05 #3
On Sat, 28 Aug 2004 02:20:35 +0200, oeyvind toft <oe******@onlin e.no>
wrote:

[Top-post fixed]
"Andrew Thompson" <Se********@www .invalid> skrev i melding
news:r0******** *************** *****@40tude.ne t...
Supply URL.


Sorry, not out there yet...
Its a big ugly script in the making...


Well, at least provide us with the (relevant) code you do have. We can
hardly tell what's wrong without seeing it!

Mike
Please do not top-post. Responses should go underneath what you are
responding to, and irrelevant text should be snipped.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
Hi again

I`ve found the problem. I had some errors in some dynamic code elements so
that
class methods called 'afunction' instead of 'this.afunction '. Thats why the
'this.obj' wasnt
recognized.

Oeyvind

--
http://home.online.no/~oeyvtoft/ToftWeb/

"Michael Winter" <M.******@bluey onder.co.invali d> skrev i melding
news:opsde3e4r2 x13kvk@atlantis ...
On Sat, 28 Aug 2004 02:20:35 +0200, oeyvind toft <oe******@onlin e.no>
wrote:

[Top-post fixed]
"Andrew Thompson" <Se********@www .invalid> skrev i melding
news:r0******** *************** *****@40tude.ne t...
Supply URL.


Sorry, not out there yet...
Its a big ugly script in the making...


Well, at least provide us with the (relevant) code you do have. We can
hardly tell what's wrong without seeing it!

Mike
Please do not top-post. Responses should go underneath what you are
responding to, and irrelevant text should be snipped.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Jul 23 '05 #5

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

Similar topics

8
3746
by: Elf M. Sternberg | last post by:
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the bind function. The problem with Javascript is that the "this" operator is poorly overloaded and it is often hard to understand in the context of object-oriented javascript So, let's start with the definition:
8
2055
by: Robert | last post by:
Hi, I can use "with" like this: function MyObject(message) { this.message = message; } function _MyObject_speak() {
2
3024
by: stephane | last post by:
Hi all, What I am trying to achieve is an 'inherits' method similar to Douglas Crockford's (http://www.crockford.com/javascript/inheritance.html) but that can enable access to the superclass' priviledged methods also. Do you know if this is possible ? In the following example, I create an ObjectA (variable a), an ObjectB which inherits ObjectA (variable b) and an ObjectC which inherits ObjectA (variable c1). The 'toString ()' method...
4
1764
by: lkrubner | last post by:
I'm reading an essay, I think one of Crockford's, and it has this example in it: function Demo() { } Demo.prototype = new Ancestor(); Demo.prototype.foo = function () { } ; Does Ancestor now have a function called foo? What if I have 5 different objects, all descended from Ancestor? Do
21
3835
by: Rob Somers | last post by:
Hey people, I read a good thread on here regarding the reason why we use function prototypes, and it answered most of my questions, but I wanted to double check on a couple of things, as I am writing something up on functions, and I don't like writing about things I am not sure about. Ok, then, here we go: I initially thought that one would only really need to use a function
6
1481
by: mmcloughlin | last post by:
I'm learning about objects and am trying to figure out how basic inheritance works. I've got into the habit of explicitly setting the prototype object with an object literal as it seems to make the creation of a class easier to read/understand. Anyway it seems to break the inheritance chain in the following code and I don't know why. window.onload = function() {
5
2233
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
6
1871
by: burningodzilla | last post by:
Hi all - I'm preparing to dive in to more complex application development using javascript, and among other things, I'm having a hard time wrapping my head around an issues regarding "inheritance" using the prototype property. I realize there are no classes in JS, that code therefore lives in objects instead of class definitions, and that "inheritance" must be achieved prototypically and not classically. That said, on with the code. Say I...
3
3577
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(options) { <...>
0
8814
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
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
7304
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
6160
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
5621
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();...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
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
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.