473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing array item

I have the following. There must be something less cumbersome without push
pop. The function parameter obj is the event.srcElemen t and has the
attributes(prop erties?) picNum and alb pinned to it. The function is part of
a process to delete the selected obj, a photo in this case from the album
vis albumArr. TIA
Jimbo
function Album(albumName ) {
this.name=album Name;
this.paths=new Array();
}
var albumArr(); // holds an array of Albums();
function removeArrSrc(ob j) {
var dummy=new Array();
for(i=0;i<album Arr.length;i++) {
dummy[i]=new Album(albumArr[i].name);
var el=albumArr[i].paths;
for(var j=0;j<el.length ;j++) {
if(dummy[i].name==obj.alb) {
if(j==obj.picNu m) continue;
}
var len=dummy[i].paths.length;
dummy[i].paths[len]=el[j];
}
}
albumArr=dummy;
}

Jul 23 '05
13 2351
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
It cannot be omitted, the expressions are not optional in all
implementations .
Can you name one where it isn't?


Micro$oft JScript, according to the MSDN Library, which IIRC matches
reality in IE 6 SP-1 on Win2k SP-4.
All three expressions are optional in Javascript 1.0 (tested in
Netscape 2.02) and in ECMAScript v1.


Yes, but non sequitur.
PointedEars
--
Bugzilla: It's not just for people with `e's in their names, anymore!
Jul 23 '05 #11
J. J. Cale wrote:
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsdjinqrx x13kvk@atlantis ...


Please do not write attribution novels and trim your quotes.
<http://netmeister.org/news/learn2quote.htm l>
I don't know what that's supposed to be, but I'm certain it'll cause an
error on most browsers. Perhaps you meant:

var albumArr = [];

Sorry! It is declared var albumArr=new Array();


Both statements are equivalent, while the former (array literal) requires
AFAIK JavaScript 1.3 (supported from Netscape Navigator 4.0 on) and
compatibles, and later. If standards compliant, the implementation must
be standards compliant to ECMAScript 3.
Your Reply-To header still does not comply with Internet/Usenet standards.
no********@nowa y012.net.il. is not an e-mail address!
PointedEars
--
squared over see squared
Jul 23 '05 #12
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
Micro$oft JScript, according to the MSDN Library, which IIRC matches
reality in IE 6 SP-1 on Win2k SP-4.


I don't have SP-1, but in IE 6 SP-2 (version
"6.0.2900.2180. xpsp_sp2_rtm.04 0803-2158") on WinXP, this script alerts
"10" as it should:
---
var x = 4;
var y = 0;
for(;;){y+=x--;if (!x) {break;}}
alert(y);
---
It seems to work as far back as IE 4 (I can't get IE 3 to run scripts)

The MSDN library is not a complete reference. There are features that
are not listed, and listed features that have unlisted exceptions.

I would be very surprised if there are any Javascript/ECMAScript/JScript-
implementations that doesn't allow you to omit all three expressions
of a "for", as that has been the expected behavior of the "for" construct
in all languages using a "C"-language-like "for" construct.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #13
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
Micro$oft JScript, according to the MSDN Library, which IIRC matches
reality in IE 6 SP-1 on Win2k SP-4.
I don't have SP-1, but in IE 6 SP-2 (version
"6.0.2900.2180. xpsp_sp2_rtm.04 0803-2158") on WinXP, this script alerts
"10" as it should:
---
var x = 4;
var y = 0;
for(;;){y+=x--;if (!x) {break;}}
alert(y);
---
It seems to work as far back as IE 4 (I can't get IE 3 to run scripts)


Apparently, my mistake was to omit the trailing ";" in

for (var x = a.length; x--;)

Reincluding it, my example code also works in my IE (see above),
and yours works, of course.
The MSDN library is not a complete reference. There are features that
are not listed, and listed features that have unlisted exceptions.
Unfortunately, yes.
I would be very surprised if there are any Javascript/ECMAScript/JScript-
implementations that doesn't allow you to omit all three expressions
of a "for", as that has been the expected behavior of the "for" construct
in all languages using a "C"-language-like "for" construct.


Me too. According to the Client-side JavaScript 1.3 Reference,
they were already optional in JavaScript 1.0 (1995) and in the
first edition of ECMAScript (1997).
PointedEars
--
Minds are like parachutes, they only work when open.
Jul 23 '05 #14

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

Similar topics

0
2474
by: sameer mowade via .NET 247 | last post by:
Hello All, I have problem while dynamically removing row from the Datagrid which i have added dynamically as shown in the following code snippet. The problem is that while removing dynamically added row it also removes the row at the end along with the added row. Plz tell me if, I am missing any thing. Code </asp:datagrid>
66
4148
by: Cor | last post by:
Hi, I start a new thread about a discussion from yesterday (or for some of us this morning). It was a not so nice discussion about dynamically removing controls from a panel or what ever. It started by an example from me, that was far from complete and with typing errors, but basically it had the meaning to show that removing controls reversible was the nicest method. This was a lets say conclusion (but what is that in a newsgroup) in a...
7
1755
by: Adam Honek | last post by:
Is there a direct way to remove one entry from a one dimensional array? I keep looking but either my eyes are funny or it isn't there. Must we really create a temp array and copy all but 1 of the entries over to delete one entry? All I want to do is remove an entry at a specified index and then have the ubound(array) go down -1.
6
6116
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or more minutes. 'REMOVE DUBLICATED VALUE FROM ARRAY +++++++++++++++++ Dim col As New Scripting.Dictionary Dim ii As Integer = 0
9
8252
by: Rob Meade | last post by:
Hi all, I have an array of lets say 10 items, I now want to remove an item, lets say from somewhere in the middle, based on one of the element values equalling a value I specify - is there a "clever" and "quick" way of doing this or, will I need to iterate through it looking for a match, and build another array where I dont find the match etc... Any advice appreciated..
9
2590
by: Rob Meade | last post by:
Hi all, Ok - so I've got the array thing going on, and the session thing going on, and up until now its all been ok. I've got my view basket page which is displaying 3 rows (as an example) - I have an input box on each row enabling the user to update the quantity. If the enter a zero I need to remove the item from the array....
5
10086
by: Phill W. | last post by:
(VB'2003) What's the correct way to remove multiple, selected items from a ListView control (say, from a ContextMenu)? I ask because I'm getting a very annoying ArgumentOutOfRangeException because the ListView seems to be trying to "re-select" items that are no longer there! for example, giventhat I have 3 items in my list: Select the first and remove it - no problem.
0
1979
by: Mike | last post by:
Hi, I have a collection object bound to a data grid, after I remove an item from the collection, the minute I click on the datagrid I get an error saying the specified argument was out of the range of valid values. After I remove the element from the collection I clear the databindings from the data grid and rebind it but as far as I can tell the collection seems to be the right size but for some reason when I
7
2845
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds to support cloning: Public Class RefClass Public tcp As TcpClient Public name As String End Class Public Class RefClassList Inherits List(Of RefClass) Implements ICloneable
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9957
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
8983
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...
0
6742
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
5386
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
2
3658
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.