|
-
Sep 19th, 2001, 08:46 AM
#1
javascript objects
I can't find my reference, can somebody tell me if this is correct syntax to define my own objects:
Code:
function object(name, id, val) {
this.name = name;
this.id = id;
this.val = val;
return this;
}
var myob = new object('ob1, 1, 43');
Thx
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 19th, 2001, 05:24 PM
#2
PowerPoster
what troube are you having? the code looks ok to me
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Sep 20th, 2001, 01:10 AM
#3
Hyperactive Member
CB,
If u want to assign the values to the individual attribute elements u have to pass the arguments in this way. Enclosing all the args within a single quoted expression will be intepreted as the first argument only. Hope this makes sense.
Try:
var myob = new object("ob1", 1, 43);
instead of
var myob = new object('ob1, 1, 43');
- Jemima.
-
Sep 20th, 2001, 09:40 AM
#4
that was a typo, I wanted to know if the return this; was correct
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 20th, 2001, 11:30 PM
#5
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|