right idea.....but lost somewhere

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard

    right idea.....but lost somewhere

    This simple change to dynamicdrive's textual tooltip does what I want
    perfectly.
    (whichcontent) determines which group of thumbs will be shown.
    My color coded editor is showing me that something is not quite kosher and I
    can't figure out what it is.
    Everything appears to be fine up until you get to i<10 then it screws up.

    I know everything else works fine.
    With a click, I can put a single image into my "middle" column with ease.
    But I want to show the entire group of thumbs, not just one.

    Any clues appreciated.



    function changethumbs(wh ichcontent){

    if (document.all|| document.getEle mentById){
    cross_el=docume nt.getElementBy Id?
    document.getEle mentById("middl e"):document.al l.middle
    counter=0
    for (i=1; i<10; i++){
    counter=counter +1
    cross_el.innerH TML='<img src="images/pic"+i+".jpg"> '

    }


    }

    }


  • Richard

    #2
    Re: right idea.....but lost somewhere

    Screw it. This innerhtml thing is not gonna do what I need done no way.


    Comment

    • RobG

      #3
      Re: right idea.....but lost somewhere

      Richard wrote:[color=blue]
      > This simple change to dynamicdrive's textual tooltip does what I want
      > perfectly.
      > (whichcontent) determines which group of thumbs will be shown.
      > My color coded editor is showing me that something is not quite kosher and I
      > can't figure out what it is.
      > Everything appears to be fine up until you get to i<10 then it screws up.[/color]

      i<10 means that it will stop when i reaches 9.
      [color=blue]
      >
      > I know everything else works fine.
      > With a click, I can put a single image into my "middle" column with ease.
      > But I want to show the entire group of thumbs, not just one.
      >
      > function changethumbs(wh ichcontent){
      >
      > if (document.all|| document.getEle mentById){
      > cross_el=docume nt.getElementBy Id?
      > document.getEle mentById("middl e"):document.al l.middle[/color]

      this can be written a little more legibly as:

      if (document.getEl ementById){
      var cross_el = document.getEle mentById('middl e');
      } else if (document.all) {
      var cross_el = document.all['middle'];
      }
      [color=blue]
      > counter=0[/color]

      Don't know what "counter" is for, but make it local if not needed as
      global:

      var counter = 0;
      [color=blue]
      > for (i=1; i<10; i++){[/color]

      This for loop will iterate 9 times, from 1 to 9 inclusive. If you want
      more, say 20, change i<10 to i<=20.
      [color=blue]
      > counter=counter +1
      > cross_el.innerH TML='<img src="images/pic"+i+".jpg"> '[/color]

      "cross_el" must be a div or span or similar, so this can be
      replaced by:

      if (document.creat eElement) {
      counter++;
      var image = document.create Element('img');
      image.src = 'images/pic' + i + '.jpg';
      image.alt = 'nothing';
      cross_el.append Child(image);
      }

      [...]



      --
      Rob

      Comment

      • Richard

        #4
        Re: right idea.....but lost somewhere

        Thanks Rob I'll look into it.



        Comment

        • Richard

          #5
          Re: right idea.....but lost somewhere

          I must be missing something because I can't get your idea to work right.
          Thanks for the lesson.


          Comment

          Working...