Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16314
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Matt McDonald <matt@fortybelow.ca> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Quotes are trouble |
| Date | Tue, 02 Oct 2012 12:43:14 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 40 |
| Message-ID | <k4f5l4$8cu$1@dont-email.me> (permalink) |
| References | <c94def8d-8e83-4b79-a971-f6be4acb5f84@r7g2000yqa.googlegroups.com> |
| Reply-To | matt@fortybelow.ca |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 2 Oct 2012 16:44:20 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="197f3b1139b8ff663a5276af9779de0b"; logging-data="8606"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Kh+lDltvcp2Dz2TKEmUGAOHQVV9a+xCA=" |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120726 Icedove/3.0.11 |
| In-Reply-To | <c94def8d-8e83-4b79-a971-f6be4acb5f84@r7g2000yqa.googlegroups.com> |
| Cancel-Lock | sha1:uEPndVeHxZcoxLzz8GwWTBB8uVw= |
| Xref | csiph.com comp.lang.javascript:16314 |
Show key headers only | View raw
On 01/10/12 17:36, justaguy wrote:
> What I want to do is, to seed and then replace an image every 500ms.
Instead of replacing an image, consider modifying its `src` property.
> HTML code:
> <div id="main"></div>
To implement such a strategy, author the image directly into the HTML
source. Then access the image via the DOM API. Consequently only one
element is ever created; and if properly authored, the image will be
usable to clients with JavaScript disabled.
>setTimeout(popMain(imgs[i]),500);
You are immediately invoking the function entitled `popMain'. Since it
does not return a function, when the time to invoke a callback arrives,
an error may be thrown. Instead, consider passing the parameter to a
function that will generate a callback as follows:
function createImageCallback(
img
)
{
return function () {
var el = img;
// code here
};
}
function createImageTimer(
img
)
{
[global object].setTimeout(
createImageCallback(img),
500
);
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Quotes are trouble justaguy <lichunshen84@gmail.com> - 2012-10-01 14:36 -0700
Re: Quotes are trouble Andrew Poulos <ap_prog@hotmail.com> - 2012-10-02 09:24 +1000
Re: Quotes are trouble justaguy <lichunshen84@gmail.com> - 2012-10-01 17:01 -0700
Re: Quotes are trouble Stefan Weiss <krewecherl@gmail.com> - 2012-10-02 02:21 +0200
Re: Quotes are trouble justaguy <lichunshen84@gmail.com> - 2012-10-01 17:38 -0700
Re: Quotes are trouble Stefan Weiss <krewecherl@gmail.com> - 2012-10-02 06:56 +0200
Re: Quotes are trouble justaguy <lichunshen84@gmail.com> - 2012-10-03 21:33 -0700
Re: Quotes are trouble "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-04 07:58 +0000
Re: Quotes are trouble Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-02 03:21 +0000
Re: Quotes are trouble Norman Peelman <npeelmandog@cfl.rr.com> - 2012-10-02 01:57 -0400
Re: Quotes are trouble Matt McDonald <matt@fortybelow.ca> - 2012-10-02 12:43 -0400
Re: Quotes are trouble Dr J R Stockton <reply1240@merlyn.demon.co.uk.invalid> - 2012-10-03 19:27 +0100
Re: Quotes are trouble justaguy <lichunshen84@gmail.com> - 2012-10-03 21:34 -0700
csiph-web