Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Auckland, New Zealand
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    target="main" in javascript

    Hi

    I am trying to make a slideshow in a framed page, and want the images to appear in the main frame. In the functions below, the images are displayed. How can I alter them, so that the images are displayed in the main target frame.

    function backward(){
    if (which>0){
    window.status=''
    which--
    document.images.photoslider.src=photos[which]
    }
    }

    function forward(){
    if (which<photos.length-1){
    which++
    document.images.photoslider.src=photos[which]
    }
    else window.status='End of gallery'
    }

    bye
    Allyson

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am not sure that this will work, but try:

    main.document.images.photoslider.src=photos[which]


    Of course then again, this may not be the correct spot for the modifying... *sigh* This area of Javascript is new to me...

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    Auckland, New Zealand
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for this suggestion, but it isn't working. I tried moving main just before .src, still doesn't work.

    Can anyone help, please.

    bye
    Allyson

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    TEXAS . . . 'nuf said
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Personally, I'd need to see your test (framed) page before giving any "quality" response. So, give us a link if you want/need more replies.
    Gordo
    "In the End, we will remember not the words of our enemies, but the silence of our friends."
    - Martin Luther King Jr. (1929-1968)

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    top.main.document.images.photoslider.src=photos[which]

    or

    top.frames["main"].document.images.photoslider.src=photos[which]

    of course in your main frame, you should have:

    <img name="photoslider">
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was close

  • #7
    New Coder
    Join Date
    Jun 2002
    Location
    Auckland, New Zealand
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Slideshow preloading

    Hi

    Thank-you all for your suggestions. The function works well.

    This function is a framed slideshow, http://homepages.ihug.co.nz/~usateden/panacea/slideshow

    I would like to modify it so that as the user is viewing the first slide, the second slide is being preloaded, so that the transition between slides is fast.

    Any suggestions on how modify the script would be very much appreciated.

    <html>

    <head>
    <title>Panacea Arts Trust</title>
    </head>

    <body background="../images/bg1.jpg">

    <table border="0" cellpadding="0">
    <tr>
    <td width="100%"><form method="POST" name="rotater">
    <div align="center"><center><p><script language="JavaScript">
    var photos=new Array()
    var text=new Array()
    var which=0
    var what=0

    /*Images */
    photos[0]="../Cards/Busy%20Lizzies.jpg"
    photos[1]="../Cards/Flowers for Elizabeth.jpg"
    photos[2]="../Cards/Potters Park.jpg"
    photos[3]="../Cards/Racing Yachts.jpg"
    photos[4]="../Cards/Nana Mouskouri.jpg"

    /*Descriptions*/
    text[0]="Busy Lizzies"
    text[1]="Flowers for Elizabth"
    text[2]="Potters Park"
    text[3]="Racing Yachts"
    text[4]="Nana Mouskouri"

    top.frames["description"].document.rotater.description.value=text[0];


    function backward(){
    if (which>0){

    window.status=''
    which--
    top.frames["main"].document.images.photoslider.src=photos[which] ;
    what--
    top.frames["description"].document.rotater.description.value=text[what];
    }
    }

    function forward(){
    if (which<photos.length-1){

    which++
    top.frames["main"].document.images.photoslider.src=photos[which] ;
    what++
    top.frames["description"].document.rotater.description.value=text[what];
    }
    else window.status='End of gallery'
    }
    Last edited by allyson; 07-23-2002 at 06:13 AM.

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    /*Images */
    photos[0]="../Cards/Busy%20Lizzies.jpg"
    photos[1]="../Cards/Flowers for Elizabeth.jpg"
    photos[2]="../Cards/Potters Park.jpg"
    photos[3]="../Cards/Racing Yachts.jpg"
    photos[4]="../Cards/Nana Mouskouri.jpg"

    function preloadImages(){
    //load first slide
    top.frames["main"].document.images.photoslider.src=photos[0];

    //pre-load other slides
    for (var i=1;i<photos.length;i++){
    image = new Image(photos[i]);
    }
    }

    window.onload=preloadImages;
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New Coder
    Join Date
    Jun 2002
    Location
    Auckland, New Zealand
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Hi

    Thankyou very much for your advice. It's been great.

    One more problem, though. Take a look at http://homepages.ihug.co.nz/~usatede...how/index.html

    When you first go into the site, everything works as it should except there is no text in the box. As the next slide shows, the textbox works, and when you click "Start Over" the first image appears, along with the appropriate text.

    The first print statement '
    top.frames["description"].document.rotater.description.value=text[0];

    appears not to work, when the webpage starts. I don't know why. Any advice. Thank-you

    bye
    Allyson

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    put it also in the onload function. One word of advice, if you are putting initial values on elements on page load using javascript, you should do it once the page has completely loaded, that is, you do it on onload event. What you were doing was, you put initial value to the description textbox that has not yet loaded.

    /*Images */
    photos[0]="../Cards/Busy%20Lizzies.jpg"
    photos[1]="../Cards/Flowers for Elizabeth.jpg"
    photos[2]="../Cards/Potters Park.jpg"
    photos[3]="../Cards/Racing Yachts.jpg"
    photos[4]="../Cards/Nana Mouskouri.jpg"

    function preloadImages(){
    //load first slide
    top.frames["main"].document.images.photoslider.src=photos[0];
    top.frames["description"].document.rotater.description.value=text[0];


    //pre-load other slides
    for (var i=1;i<photos.length;i++){
    image = new Image(photos[i]);
    }
    }

    window.onload=preloadImages;
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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