I want to use a slideshow on a web page, which could be implemented using either Javascript or an applet. Which on is the best option?

Thanks.

Dani AI

Generated

A short, practical add-on to the thread (for and anyone landing here later): the right way to build a slideshow today is to treat it like a regular piece of content — semantic HTML first, small CSS for transitions, then unobtrusive JavaScript for controls/behaviour. That gives a robust baseline (works if scripts fail), keeps things indexable, and reduces long-term maintenance. (smashingmagazine.com) Progressive enhancement guide.

Make accessibility a design requirement, not an afterthought. Use a carousel container with a clear label and aria-roledescription="carousel", slides as groups with aria-roledescription="slide", native buttons for previous/next and a start/stop control for autoplay. Ensure auto-rotation pauses on focus and provide keyboard controls — the WAI-ARIA Authoring Practices explain the keyboard and labeling rules and include working examples. (w3.org) WAI-ARIA carousel pattern and examples

A minimal, copyable skeleton (semantic + accessible):

<div class="carousel" role="region" aria-roledescription="carousel" aria-label="Featured images">
  <div class="slides">
    <div class="slide" role="group" aria-roledescription="slide" aria-label="Slide 1 of 5">
      <img src="image-1.jpg" alt="..." />
    </div>
    <!-- more slides -->
  </div>

  <button class="prev" aria-label="Previous slide">‹</button>
  <button class="next" aria-label="Next slide">›</button>
  <button class="autoplay" aria-pressed="false" aria-label="Stop autoplay">Stop</button>
</div>

Make images responsive and fast: serve appropriate sizes with srcset/sizes or <picture>, defer off-screen assets with loading="lazy" (or IntersectionObserver where needed), and animate slides using transform/opacity (and will-change only when necessary) so animations stay smooth. These techniques reduce bandwidth and avoid repaint/layout jank. (developer.mozilla.org) Responsive images · Lazy loading guide · Animating for performance

If you prefer a finished library, pick a focused, actively maintained slider (for example, Swiper) that supports touch, lazy-loading and virtual slides — otherwise keep your script small and test on keyboard, screen readers and low-end devices. Balance features vs. maintenance: sometimes simple, well-tested custom code beats a heavy plugin. (swiperjs.com) Swiper (example)

Notes tied to earlier replies: the participants here raised the plugin-vs-JS question — the advice above gives a modern, accessible, and maintainable path that avoids plugin dependencies while addressing the practical needs a slideshow typically has.

Recommended Answers

All 6 Replies

JavaScript. Java applets died a long time ago.

commented: Too right, and they suck ass! +11

JavaScript. It is supported by default at clients' machines (if client has not disabled JavaScript), but applets are not supported any more by windows, so, client must search somewhere and install Java suppore to his machine so that to be able to see your applet.

> but applets are not supported any more by windows,
Says who?

You just need the Java runtime environment (JRE) to run applets on you machine.

Member Avatar for Member #46692

Java applets and their use thereof died a long time ago - may they rest in piece. Flash is the preferred alternative, but if javascript will suffice use that as long as it is not to gimmicky.

Java still has a use, but not any more on 'popular websites'; Java is used often for graphical simulations of physics, maths, network principals - it can still be found, and it certainly works on windows, the only change is that MS don't package a proprietry JVM with Windows anymore; which is honestly a good thing for Java.

I use Javascript over Flash for most things; use Flash only if you want a microapplication completely separated from the rest of a page embedded within a page.

Thanks for the advice. I'll use Javascript.

It seems strange that Applets aren't so popular, as Java is a popular programming language. But i've never used flash so i couldn't really compare why you would choose one over the other.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.