Image changer..

Discussion in 'Javascript' started by Barely Audible, Jun 6, 2009.

  1. Anyone any suggestions for a script that will change an image in an html
    page at regular intervals?

    --
    TTFN
    Jim

    The one item you need is always in short supply.
    -- Murphy's Military Laws, #41
    Barely Audible, Jun 6, 2009
    #1
    1. Advertising

  2. Barely Audible

    rf Guest

    Barely Audible wrote:
    > Anyone any suggestions for a script that will change an image in an
    > html page at regular intervals?


    Yes. None. Don't do it.

    Such changing stuff draws the attention of the viewer away from the actual
    content of the page, assuming the page actually has some content.

    --
    Richard.
    rf, Jun 6, 2009
    #2
    1. Advertising

  3. Barely Audible

    Evertjan. Guest

    Barely Audible wrote on 06 jun 2009 in comp.lang.javascript:

    > Anyone any suggestions for a script that will change an image in an html
    > page at regular intervals?


    There are thousands of javascript slideshows on the web on the web,
    most are not exactly what you want, are very badly written.

    So write one yourself having mastered some Javascript,
    or pay for a professional to help you.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jun 6, 2009
    #3
  4. Barely Audible wrote:
    > Anyone any suggestions for a script that will change an image in an html
    > page at regular intervals?


    Yes. What have you tried?


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 6, 2009
    #4
  5. Barely Audible

    VK Guest

    VK, Jun 6, 2009
    #5
  6. VK wrote:
    > Barely Audible wrote:
    >> Anyone any suggestions for a script that will change an image in an html
    >> page at regular intervals?

    >
    > Something like this?
    > http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm


    I expected someone to come up with junk like this, and when I noticed
    your haunting this group again, I was certain that would include you.


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 6, 2009
    #6
  7. Barely Audible

    VK Guest

    On Jun 6, 9:20 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > VK wrote:
    > > Barely Audible wrote:
    > >> Anyone any suggestions for a script that will change an image in an html
    > >> page at regular intervals?

    >
    > > Something like this?
    > >http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

    >
    > I expected someone to come up with junk like this, and when I noticed
    > your haunting this group again, I was certain that would include you.


    Did you write or do you know a better one? Do not hesitate to share
    it. c.l.j. is open for anyone posting - even for you.

    As a side not I did not claim that it is the best out of all or an
    absolutely reliable script. I just pointed to the script that
    seemingly does what OP seemingly wants. What problem do you have with
    that?
    VK, Jun 6, 2009
    #7
  8. VK wrote:
    > On Jun 6, 9:20 pm, Thomas 'PointedEars' Lahn <>
    > wrote:
    >> VK wrote:
    >>> Barely Audible wrote:
    >>>> Anyone any suggestions for a script that will change an image in an html
    >>>> page at regular intervals?
    >>> Something like this?
    >>> http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

    >> I expected someone to come up with junk like this, and when I noticed
    >> your haunting this group again, I was certain that would include you.

    >
    > Did you write or do you know a better one? Do not hesitate to share
    > it. c.l.j. is open for anyone posting - even for you.
    >
    > As a side not I did not claim that it is the best out of all or an
    > absolutely reliable script. I just pointed to the script that
    > seemingly does what OP seemingly wants. What problem do you have with
    > that?


    It doesn't have pointed ears?

    Nuff said.
    The Natural Philosopher, Jun 6, 2009
    #8
  9. VK wrote:
    > Thomas 'PointedEars' Lahn wrote:
    >> VK wrote:
    >>> Barely Audible wrote:
    >>>> Anyone any suggestions for a script that will change an image in an html
    >>>> page at regular intervals?
    >>> Something like this?
    >>> http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

    >> I expected someone to come up with junk like this, and when I noticed
    >> your haunting this group again, I was certain that would include you.

    >
    > Did you write or do you know a better one? Do not hesitate to share
    > it. c.l.j. is open for anyone posting - even for you.


    False dilemma. If a thing has properties that are objectively bad enough
    that it should not be used, there is no need to prove that a better thing
    exists in order not to use the first thing.

    BTW, your being only an infrequent nuisance around here make your attempts
    at patronizing me of all people, arguably a longtime regular to this
    newsgroup, look rather ridiculous.

    > As a side not I did not claim that it is the best out of all or an
    > absolutely reliable script. I just pointed to the script that
    > seemingly does what OP seemingly wants. What problem do you have with
    > that?


    If you would not think that this can or should be used, you would not post
    it without comment. That is the problem.


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 6, 2009
    #9
  10. if I come on this newsgroup again someone shoot me....

    --
    TTFN
    Jim

    The best armor is staying out of gun-shot.
    -- Italian proverb
    Barely Audible, Jun 6, 2009
    #10
  11. Barely Audible

    VK Guest

    On Jun 7, 12:29 am, Barely Audible <>
    wrote:
    > if I come on this newsgroup again someone shoot me....


    Really sorry for all this. Good luck in your project.
    VK, Jun 6, 2009
    #11
  12. Barely Audible wrote:
    > if I come on this newsgroup again someone shoot me....


    Just say so and I'll call the people with the huge black van to come for you.


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 6, 2009
    #12
  13. Barely Audible wrote:
    > if I come on this newsgroup again someone shoot me....
    >

    I know what you mean...;-)
    The Natural Philosopher, Jun 6, 2009
    #13
  14. Barely Audible <> writes:

    > if I come on this newsgroup again someone shoot me....


    Can't blame you, although a good killfile will go a long way.

    And, just for the record:

    function slideshow(imageId, interval, imageUrls) {
    var counter = 0;
    return setInterval(function() {
    counter = (counter + 1) % imageUrls.length;
    var img = document.images[imageId];
    img.src = imageUrls[counter];
    }, interval);
    };

    Use as, e.g.,

    <img id="ssimg" src="img1.png">
    <script type="text/javascript">
    // Call directly, or in an onload event handler.
    slideshow("ssimg", 5000, ["img1.png", "img2.png", "img3.png"]);
    </script>

    This changes the src of the image element every five seconds.
    It starts at the second image in the list, assuming that the first one
    is being displayed by default. If you want it to start at the first URL,
    move the counter increment to the end of the function instead of the start.

    If you ever need the slideshop to stop, remember the return value and
    call clearInterval with it as argument.

    /L
    --
    Lasse Reichstein Holst Nielsen
    'Javascript frameworks is a disruptive technology'
    Lasse Reichstein Nielsen, Jun 7, 2009
    #14
  15. Conrad Lender wrote:
    > Thomas 'PointedEars' Lahn wrote:
    >> Barely Audible wrote:
    >>> if I come on this newsgroup again someone shoot me....

    >> Just say so and I'll call the people with the huge black van to come
    >> for you.

    >
    > Yes. Shoot the newbie, great idea. If you continue to drive away people
    > who come here asking for advice, don't be surprised when they turn to a
    > subpar solution like dynamicdrive or JQuery. [...]


    Your Irony Detector[tm] is borken.


    PointedEars
    Thomas 'PointedEars' Lahn, Jun 7, 2009
    #15
  16. Barely Audible

    SAM Guest

    Le 6/6/09 2:03 PM, Barely Audible a écrit :
    > Anyone any suggestions for a script that will change an image in an html
    > page at regular intervals?


    for 10 images named '1.jpg' to '10.jpg' :

    JS:
    ===
    var imgsIdx = 1;
    function chgeImg() {
    var I = document.images&&document.images.viewer?
    document.images.viewer :
    document.getElementById('viewer')?
    document.getElementById('viewer') :
    null;
    imgsIdx++;
    if(imgsIdx>10) imgsIdx = 0;
    if(I) I.src = imgsIdx + '.jpg';
    }
    window.onload = setInterval('chgeImg()', 3000);

    HTML:
    =====
    <img name="viewer" id="viewer" src="1.jpg">


    --
    sm
    SAM, Jun 7, 2009
    #16
  17. I am with you, Conrad.

    I may have tried to write something (if I dared on this elite group) but
    your code looks great for a 2-minute effort.

    From a person obviously not as expert in JavaScript as "Pointed Ears" or as
    Conrad.

    I wonder who is better at sharing their expertise?
    (The question is rhetorical).
    --
    Trevor Lawrence
    Canberra
    Web Site http://trevorl.mvps.org

    "Conrad Lender" <> wrote in message
    news:p...
    > On 06/06/09 23:14, Thomas 'PointedEars' Lahn wrote:
    >> Barely Audible wrote:
    >>> if I come on this newsgroup again someone shoot me....

    >>
    >> Just say so and I'll call the people with the huge black van to come
    >> for you.

    >
    > Yes. Shoot the newbie, great idea. If you continue to drive away people
    > who come here asking for advice, don't be surprised when they turn to a
    > subpar solution like dynamicdrive or JQuery. He's probably not reading
    > this group anymore (and after those replies, I don't blame him), but for
    > the record, here's a possible solution to his problem (untested):
    >
    > <img src="foo.jpg" id="myImg" ....>
    >
    > <script type="text/javascript">
    >
    > var imgSrcList = [
    > "foo.jpg",
    > "bar.jpg",
    > "baz.jpg"
    > ],
    > i = 0,
    > delay = 3000,
    > img;
    >
    > function nextImg () {
    > img.src = imgSrcList[++i % 3];
    > window.setTimeout(nextImg, delay);
    > }
    >
    > if ("getElementById" in document
    > && "setTimeout" in window
    > && (img = document.getElementById("myImg")))
    > {
    > window.setTimeout(nextImg, delay);
    > }
    >
    > </script>
    >
    > That took all of 2 minutes. I don't think the OP was unreasonable in
    > hoping for at least one helpful reply.
    >
    >
    > - Conrad
    Trevor Lawrence, Jun 7, 2009
    #17
  18. Barely Audible

    Jeff Guest

    VK wrote:
    > On Jun 7, 12:29 am, Barely Audible <>
    > wrote:
    >> if I come on this newsgroup again someone shoot me....

    >
    > Really sorry for all this. Good luck in your project.



    Well, Thomas may not be the most likable fellow, but he is right.

    Your "solution" does not answer the OPs question, the OP asked for an
    image changer while yours rewrites a div and would need adapting. It
    also loads a huge amount of bloated code and requires a lot of set up.
    All totally unneeded.

    The real solution is simple, but requires some initial effort be put
    out by the OP.

    What you have done is encourage the OP to always take the spoon fed
    answer, and to disparage anyone who is actually trying to teach them to
    fish. All this does is create another whining slacker who will just
    haunt somewhere else for the non solution.

    Not the first time I have seen this.

    Jeff
    Jeff, Jun 10, 2009
    #18
  19. Barely Audible

    VK Guest

    >    Your "solution" does not answer the OPs question, the OP asked foran
    > image changer while yours rewrites a div and would need adapting. It
    > also loads a huge amount of bloated code and requires a lot of set up.
    > All totally unneeded.


    So keep handy a set of scripts you personally like for js-trivia
    (slide show, collapsing menu lists etc.) and post them.

    >    The real solution is simple, but requires some initial effort be put
    > out by the OP.
    >
    >    What you have done is encourage the OP to always take the spoon fed
    > answer, and to disparage anyone who is actually trying to teach them to
    > fish. All this does is create another whining slacker who will just
    > haunt somewhere else for the non solution.
    >
    >    Not the first time I have seen this.


    And not the last, let me assure you on that. You see, the teaching is
    needed when asked, not because one self-appointed himself to teach the
    entire world. OP asked for a "suggestions for a script", not how to
    write a script or how to learn Javascript in the most effective way.
    What do you know about this person and why are you so sure that he has
    to learn the language? There are (at least they were here before)
    people just willing to put some family photos or school photos on
    their site as a slide show. Why the hell they need to learn Javascript
    just to eventually write yet another 1,000,001st variant of the
    script? If OP states something like "I am learning JavaScript and..."
    or "I am playing around with JavaScript and..." then go ahead.
    Otherwise this Asian market like crowd of "fishing stick sellers"
    scares sh*t out of newcomers. ;-)
    VK, Jun 10, 2009
    #19
  20. Barely Audible

    Jeff Guest

    VK wrote:
    <snip>

    e non solution.
    >>
    >> Not the first time I have seen this.

    >
    > And not the last, let me assure you on that. You see, the teaching is
    > needed when asked, not because one self-appointed himself to teach the
    > entire world.


    There are plenty of forums where such information can be exchanged.
    Historically the use of usenet has been a bit different. Particularly in
    any of the comp.lang groups.

    I think it's best not to cheapen and waste such a valuable resource
    than to cater to what can be found in thousands of other places.

    Have you ever read the FAQ for this group?:

    http://www.jibbering.com/faq/

    Note the bit about what to do before you post.


    OP asked for a "suggestions for a script", not how to
    > write a script or how to learn Javascript in the most effective way.



    This not a forum, this is usenet. It's a great place to learn from
    some very sharp people. When you lower it to a lazy mans resource you
    remove the incentive for experts to hang out here.

    >


    Jeff
    Jeff, Jun 11, 2009
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Tegala

    File Extension Changer program

    Andrew Tegala, Aug 13, 2003, in forum: Java
    Replies:
    1
    Views:
    526
    Neomorph
    Aug 14, 2003
  2. Terrance N. Phillip

    System Independent Wallpaper Changer

    Terrance N. Phillip, Jul 6, 2005, in forum: Python
    Replies:
    4
    Views:
    471
    Terrance N. Phillip
    Jul 6, 2005
  3. RigasMinho

    XSL page update URL changer?

    RigasMinho, Mar 27, 2007, in forum: XML
    Replies:
    4
    Views:
    512
    Simon Brooke
    Mar 28, 2007
  4. Spartanicus

    Javascript image changer

    Spartanicus, Jun 26, 2004, in forum: Javascript
    Replies:
    1
    Views:
    86
    Lasse Reichstein Nielsen
    Jun 26, 2004
  5. Barely Audible

    Image changer

    Barely Audible, Feb 22, 2007, in forum: Javascript
    Replies:
    7
    Views:
    91
Loading...

Share This Page