-
April 7th, 2008, 03:10 PM
#1
Senior Member
Javascript: removing element from object
Hi
I have an object in Javascript of a structure like:
objID{ name, arr[], int}
now the arr[] is of the length = 7.
so, its like objID.arr[0] to objID.arr[6].
Now, I have a requirement of removing an element from this array according to the scenario.
Say Idx is the array element to be deleted
So, I tried objID.arr.splice(Idx, 1);
to which I got the exception:
"Microsoft JScript runtime error: Object doesn't support this property or method"
And then I tried delete objID.arr[Idx];
to which I got the exception:
"Microsoft JScript runtime error: Object doesn't support this action"
so, what can be done to remove the element from the object and then adjust the arrays.
Like, if in the starting I have array of 4 elements like:
objID.arr[0] = a
objID.arr[1] = b
objID.arr[2] = c
objID.arr[3] = d
and I remove the element at index 2! the new array should be like:
objID.arr[0] = a
objID.arr[1] = b
objID.arr[2] = d
Thanks in advance!
-
April 8th, 2008, 01:23 AM
#2
-
April 15th, 2008, 12:43 PM
#3
Senior Member
that was a lot of help! thanks!
-
April 16th, 2008, 06:40 PM
#4
Similar Threads
-
By cheyenne1212 in forum Miscellaneous Security Discussions
Replies: 7
Last Post: February 1st, 2012, 02:51 PM
-
By jerichoholic in forum Spyware / Adware
Replies: 12
Last Post: November 30th, 2004, 11:14 AM
-
By coolcamel in forum Spyware / Adware
Replies: 8
Last Post: September 29th, 2004, 02:54 PM
-
By jethro in forum Other Tutorials Forum
Replies: 5
Last Post: November 3rd, 2002, 03:09 PM
-
By Remote_Access_ in forum Security Archives
Replies: 4
Last Post: January 3rd, 2002, 11:11 PM
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
|
|