473,511 Members | 16,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change struct values

18 New Member
Hello all the coders!

Iīm trying to attrib a value to x and y, what am I doing wrong?

Expand|Select|Wrap|Line Numbers
  1. this.start = { x:"hello1", y:"hello2" }
  2.  
when printing this.start.x it gives me " runtime error: 'this.start.x' is null or not an object". (IE7)

finally, It might be handy to attrib those values through other vars, but I think I could do that if I managed to work that x and y.

thanks in advance for any kind of help
Apr 15 '08 #1
4 1246
pronerd
392 Recognized Expert Contributor
I do not think structs are supported in JavaScript. You could do this as an array, or as an object though



Expand|Select|Wrap|Line Numbers
  1. // Object example
  2. this.start = {  var x = "hello1";  var y = "hello2"; }
  3.  
  4. //Array Example
  5. this.start['x'] = 'hello1';
  6. this.start['y'] = 'hello2';
  7.  
Apr 15 '08 #2
Nibbus
18 New Member
thanks for your answer pronerd, but I still canīt work it out... even by object as you sugested (the array should work by I really wanted not to be by array).

the code I posted works in FF, thatīs why I wanted to follow the same approach for IE7...
Apr 15 '08 #3
pronerd
392 Recognized Expert Contributor
I still canīt work it out..
Can't work what out? Are you getting an error? If so what does it say?
Apr 16 '08 #4
gits
5,390 Recognized Expert Moderator Expert
hmmm ...

i think:

Expand|Select|Wrap|Line Numbers
  1. this.start = {  var x = "hello1";  var y = "hello2"; }
  2.  
should be:

Expand|Select|Wrap|Line Numbers
  1. this.start = {  x: "hello1",  y: "hello2" };
kind regards
Apr 16 '08 #5

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

Similar topics

8
3540
by: Grant Edwards | last post by:
Perhaps I'm doing something wrong: the struct module docs say it's IEE 754, but I can't figure out how to get it to handle NaN values correctly (either packing or unpacking). >>> x =...
19
2349
by: felixnielsen | last post by:
Some might remember that i, not so long ago, started a treath or two about a weird 3d labyrinth. I now have a working code, that i want to share, hear comments, advice, ect., but first let me...
74
15869
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
45
18765
by: Zytan | last post by:
This returns the following error: "Cannot modify the return value of 'System.Collections.Generic.List<MyStruct>.this' because it is not a variable" and I have no idea why! Do lists return copies...
4
2453
by: Joshua J. Kugler | last post by:
I'm trying to put some values into a struct. Some of these values are NaN and Inf due to the nature of the data. As you well may know, struct (and other things) in Python <= 2.4 doesn't support...
0
7242
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
7355
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,...
1
7081
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...
1
5066
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...
0
4737
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...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
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 ...
0
447
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...

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.