A slide show sequences through pictures of products. Wouldn't it be nice if the user could stop the slide show, go back to the previous picture, click on the picture to get detailed information about the product?
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact Advertise on Bucaro TecHelp Advertise Here RSS News Feeds News Feeds

HTML5 Solutions: Essential Techniques for HTML5 Developers

Essential Techniques for HTML5 Developers

HTML5 brings the biggest changes to HTML in years. Web designers now have new techniques, from displaying video and audio natively in HTML, to creating realtime graphics on a web page without a plugin.

This book provides a collection of solutions to all of the most common HTML5 problems. Every solution contains sample code that is production-ready and can be applied to any project.

Click Here

Easy Java Script Slide Show Code With Linked Slides

A slide show is a great webpage element for a website that sells almost any product. The slide show sequences through pictures of the products. But what if the user sees the picture of a product that they're interested in? Wouldn't it be nice if they could stop the slide show, go back to the previous picture, click on the picture to get detailed information about the product? In this article, you'll learn how to design a slide show that does all that and also displays a "tool tip" description of the product.

To place the slide show on your webpage, simply paste the code for an html span as shown below.

<span id="show"></span>

Next, paste the delimiter tags for a Java Script code block into the HEAD section of your webpage as shown below.

<head>
<script language="JavaScript">

</script>
</head>

Inside the Java Script code block, place the declaration for variables named i and timer, and an array named slide, as shown below.

<script language="JavaScript">
var i = 0, timer;
var slide = new Array();

</script>

Under the variable declarations, enter your list of slides, assigning them as elements in the array as shown below.

slide[0] = "page1.htm,Dodge Neon,neon.jpg";
slide[1] = "page2.htm,Dodge Stratus,stratus.jpg";
slide[2] = "page3.htm,Dodge Viper,viper.jpg";

The definition of each slide is a character string in quotes. Each character string consists of three parts separated by commas. The first part is the url of the webpage that the user will be taken to when they click on the slide. The second part is the text to be used in the slides tool tip. The third part is the path to the image to be used for the slide.

Below the list of slides, paste the Java Script function that swaps the slides. The code for the swapImage() function is shown below.

function swapImage()
{
  var strArray = slide[i].split(",");

  document.getElementById("show").innerHTML = 
"<a href='" +  strArray[0] + "'>" +
"<img alt='" + strArray[1] + "' " +
"border=0 width=140 height=68 src='" + strArray[2] + "'></a>";
}

The first line inside the swapImage() function splits the slide definition character string at the commas and places the resulting elements in an array named strArray. The remaining code uses the elements in that array to format html code that is placed inside the span.

Note that this code predefines the images to be 140 x 68 pixels in size. In this example, the images should all be the same size. Edit the width and height attributes in the code to the size of your images. If the images are not all the same size, your web page may grow and shrink as the different images are displayed.

You can use a graphics application to crop and resize your images so that they are all the same size. Mofifying the code to display images of different sizes without growing and shrinking your web page is not difficult, but I have left that out of this example in order to simplify the code.

RSS Feed RSS Feed



Web Design Sections

Eloquent JavaScript: A Modern Introduction to Programming

Eloquent JavaScript

Eloquent JavaScript Eloquent JavaScript goes beyond the cut-and-paste scripts of the recipe books and teaches you to write code that's elegant and effective. You'll start with the basics of programming, and learn to use variables, control structures, functions, and data structures. Then you'll dive into the real JavaScript artistry: higher-order functions, closures, and object-oriented programming.

Reader Anthony says, "This book is not your typical Javascript book. Others have a utilitarian approach. In stark contrast, Eloquent JavaScript does not merely provide you a checklist of things to learn but rather paints a panorama of the possibilities that programming provides. Javascript is merely the tool used to introduce these to the reader.

Click here for more information.


[Site User Agreement] [Advertise on This site] [Search This Site] [Contact Form]
Copyright©2001-2011 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268