Using a Java Script on my Web Page

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Using a Java Script on my Web Page

  1. #1
    Join Date
    Nov 2002

    Using a Java Script on my Web Page


    I am having some trouble getting a Java Script working, that I cut and pasted into my web page. As far as I can tell I did setup the script on page as instructed, but just cannot get it to function correctly when previewing the page. The script is actually this one by and is there slideshow. If I try using it with just one picture, when displaying the page....the picture shows up and fades out. If I put more pics in, then they all show up at one time across the page. and not within the one table. I may get one of them to fade out as well and that is about it. I guess I need to figure out how to stack them and have this script bring up each one and keep on repeating the show as it should. I am sure there is a simple problem here, but I just cannot put my finger on it ;-) I am using Dreamweaver 4.1 as my HTML editor by the way. Thanks for any help, and it would be greatly appreciated for a newbie as myself.


    Script: JavaScript Cross-Browser SlideShow Script
    With Cross-Fade Effect between Images
    Adjustable Timing and Unlimited Images
    Function: Displays images continuously in a slideshow
    presentation format, with a fade effect on
    image transitions.
    Browsers: All common browsers: NS3-6, IE 4-6
    Fade effect only in IE; others degrade gracefully
    Author: etLux

    Step 1.
    Put the following script in the head of your page:

    // (C) 2000
    // Free for all users, but leave in this header
    // NS4-6,IE4-6
    // Fade effect only in IE; degrades gracefully

    // =======================================
    // set the following variables
    // =======================================

    // Set slideShowSpeed (milliseconds)
    var slideShowSpeed = 5000

    // Duration of crossfade (seconds)
    var crossFadeDuration = 3

    // Specify the image files
    var Pic = new Array() // don't touch this
    // to add more images, just continue
    // the pattern, adding to the array below

    Pic[0] = '1.jpg'
    Pic[1] = '2.jpg'
    Pic[2] = '3.jpg'
    Pic[3] = '4.jpg'
    Pic[4] = '5.jpg'

    // =======================================
    // do not edit anything below this line
    // =======================================

    var t
    var j = 0
    var p = Pic.length

    var preLoad = new Array()
    for (i = 0; i < p; i++){
    preLoad[i] = new Image()
    preLoad[i].src = Pic[i]

    function runSlideShow(){
    if (document.all){"blendTrans(duration=2)""blendTrans(duration=crossFadeDuration)"
    document.images.SlideShow.src = preLoad[j].src
    if (document.all){
    j = j + 1
    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', slideShowSpeed)


    Step 2.
    Put this onload event call in your body tag:

    <body onload="runSlideShow()">


    Step 3.
    Put this in the body of your page where you want the
    slide show to appear.

    Set widths and heights same as images
    Set image file same as first image in array Pic[] (above)

    <table border="0" cellpadding="0" cellspacing="0">
    <td id="VU" height=150 width=150>


  2. #2
    Join Date
    Sep 2002
    Hi, CK

    Have you uploaded your site to the net? If so, could you post the url for us to have a look at it?

    The other thing I should point out is that this forum is for JAVA, which is a different language from JavaScript. Below is a link to a JavaScript forum:^3027@.ee6b313

    Best regards
    Joyous Monkey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center