Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Badly need helps from experts

    hey all,
    im interested in learning to make slide show using javascript..i read some article and got some ideas somehow when i tried to create by my own it give me problem...i got some example from Internet and tried it...this is the code that i got and i edited it to what i want:
    For example here:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
    <script language="javascript">
    var image1=new Image();
    var image2=new Image();
    var image3=new Image();
    <img src="./index.jpg" name="slide">
    //variable that will increment through the images
    var incre=1;
    function slidepics(){
    document.images.slide.src=eval("image"+incre+".src ");
    if (step<3)
    //after 1s the pics will be changed

    So any ideas...please help cause i tried it since yesterday and dont get why it didnt do as i wished...huhu...thanks in advanced

  2. #2
    I modified your code slightly (to make it easier for me to read) and changed the way the Javascript gets called, try this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
    <script type="text/javascript">
    var image1 = 'index.jpg'
    var image2 = 'index1.jpg'
    var image3 = 'index2.jpg'
    var step = 1;
    slideshow();//call the function.
    function slideshow() {
      var myid = 'slide';
      var image = image = eval('image'+step);
        document.getElementById(myid).src = image;
        step++;//increment counter
      } else {
      setTimeout( slideshow, 1000 );
    <img id='slide' src='index.jpg'>

  3. #3
    thanks for ur code it works really well...

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts