473,407 Members | 2,676 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,407 software developers and data experts.

missing : after property id

Ciary
247 Expert 100+
hi all,

i have a problem with some javascript i've created. im trying to create a new class but on the second line (after i created the class) firebug throws me a 'fatal error: missing : after property id' (wth, how unclear can you be???). i've searched google te find out whats causing it but all things i found were irrelevant to my problem.

here is the code where the error occurs.
Expand|Select|Wrap|Line Numbers
  1. myclass = Class.create({
  2.                 private demo1            = "";             //ERROR
  3.                 private demo2            = "";
  4.                 private demo3            = "";
  5.  
  6.           ...
  7.  
  8.          })
  9.  
i've also tried to do it with 'var' instead of 'private' and i also tried 'var myclass = {' but it didnt work either.

i hope someone can help me out.
Apr 2 '09 #1
7 12608
gits
5,390 Expert Mod 4TB
do you use any framework? Class.create() is not a native javascript method. in any case when you write:

Expand|Select|Wrap|Line Numbers
  1. // this are object literals to create a new javascript object
  2. {}
you have to use it the following way:

Expand|Select|Wrap|Line Numbers
  1. {
  2.     foo: 'bar',
  3.     bar: 'foo'
  4. }
kind regards
Apr 2 '09 #2
Dormilich
8,658 Expert Mod 8TB
Are you sure that's JavaScript (that script language used on websites) or do you mean Java?

[edit] darn again, second time today...
Apr 2 '09 #3
Ciary
247 Expert 100+
i got it from another javascript library so i'm pretty sure it's javascript. anyhow, when i tried this code it gave nearly the same error, but then on the first line. although this time it was because of a ; rather then a :

the error: 'fatal error: missing ; before statement'
Expand|Select|Wrap|Line Numbers
  1. myclass{                                                            //ERROR
  2.                  private demo1            = "",
  3.                  private demo2            = "",
  4.                  private demo3            = "",
  5.  
  6.            ...
  7.  
  8.           }
  9.  
Apr 2 '09 #4
gits
5,390 Expert Mod 4TB
as i already showed you ... the curly brackets are syntactically object literals. when you create a 'class' you would need to write a constructor and its methods unless you use a javascript-lib to 'help' you:

example for a selfmade 'class'

Expand|Select|Wrap|Line Numbers
  1. function OBJ() {
  2.     this.foo = 'bar';
  3.     this.bar = 'foo';
  4. }
  5.  
  6. var o = new OBJ;
  7.  
  8. alert(o.foo);
  9.  
or when you use a lib it might look like:

Expand|Select|Wrap|Line Numbers
  1. var o = Class.create({
  2.     foo: 'bar',
  3.     bar: 'foo'
  4. });
Apr 2 '09 #5
Ciary
247 Expert 100+
gits, you're the best!!

its working now. i didn't actually knew what you ment by your first post. that's why i asked again. i'm sorry for that.
Apr 2 '09 #6
gits
5,390 Expert Mod 4TB
no problem ... :) ... in case you have more questions just post back to the forum ...

kind regards
Apr 2 '09 #7
RamananKalirajan
608 512MB
class.Create({.....}); it is used in prototype framework.....
Apr 2 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: eddie wang | last post by:
Hi, I got the following error when access an asp page. Please help. Thanks. Response object error 'ASP 0185 : 8002000e' Missing Default Property /downtime_category-old2.asp, line 0 A default...
6
by: dmiller23462 | last post by:
Here is the code, it's not complete of course....I've been inserting lines as I go to pinpoint the issue.....I understand that the error message I'm getting (#185 Missing Default Property) is...
0
by: Alberto Grosso Nicolin | last post by:
We have the following XML schema: there's a root element (Response) with of a single child element (Result). ...
3
by: John Kristensen | last post by:
Hi I'm having a little stupid problem when trying to change properties in a Textbox (or a label) using Event Procedures. Im doing a report and want to change the Control Source in a textbox,...
1
by: Kun | last post by:
Hi there, I think vs.net missing default name for new form. Scenario: 1. I create new Window Application by default it give me Form1 2. I add Form2 3. In Form1_Load event I try to get form2...
4
by: Marc van den Bogaard | last post by:
hello together, my datarow.item property is missing, i just can accesss the ItemArray property, what is wrong with this? System.Data.DataSet dataset1 = new System.Data.DataSet(); ...
1
by: rb | last post by:
I'm a bit confused with this new data binding methodology - well, at least the "visual" part of it. With asp.net 1, I used be able to "mouse-my-way" around data binding instead of doing it in...
2
by: Steve Harclerode | last post by:
Hi, When I used Visual Studio 2002, I was able to add / delete colums from a DataGrid at design time using a "property builder". Now I'm using Visual Studio 2005, the "property builder" option...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.