Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22468
| From | "Robert Crandal" <noreply2me@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| References | <ROqdnRynNfBWDCLPnZ2dnUVZ5u2dnZ2d@giganews.com> |
| Subject | Re: Wierd use of "new function() {}" |
| Date | 2013-12-28 20:42 -0700 |
| Message-ID | <Ks-dnQAIxZaKByLPnZ2dnUVZ5gOdnZ2d@giganews.com> (permalink) |
In case anyone wants to see the actual code, here it is:
//
// This code is supposed to initialize a slideshow over a
// particular image gallery.
//
function startShow(obj) {
var elem = tag("li", obj); // Locate elements by tag
var gallery = id("gallery"); // Locate tag by ID
for (var i = 0; i < elem.length; i++) new function() {
var cur = elem[i];
setTimeout(function() {
showImage(cur);
setTimeout(function() {
fadeOut(gallery, 0, 10);
}, 3500);
}, i * 5000);
}
setTimeout(hideOverlay, 5000 * elem.length);
showOverlay();
}
I was just confused about the use of the "new function() {}" as
seen above. Hopefully someone can explain that to me.
Thanks!
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Wierd use of "new function() {}" "Robert Crandal" <noreply2me@yahoo.com> - 2013-12-28 20:06 -0700
Re: Wierd use of "new function() {}" "Robert Crandal" <noreply2me@yahoo.com> - 2013-12-28 20:42 -0700
Re: Wierd use of "new function() {}" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-29 17:45 +0100
Re: Wierd use of "new function() {}" Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-29 02:26 -0200
Re: Wierd use of "new function() {}" John Harris <niam@jghnorth.org.uk.invalid> - 2013-12-29 11:07 +0000
Re: Wierd use of "new function() {}" Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-29 11:52 -0200
Re: Wierd use of "new function() {}" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-12-29 19:39 +0000
Re: Wierd use of "new function() {}" John Harris <niam@jghnorth.org.uk.invalid> - 2013-12-30 15:27 +0000
csiph-web