SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Netscape puts a 'br' between images, even though it is not in the code

    Please take a look at the following page: http://www.nimlok.com/rent_search/tst1/index.html
    I have a layer on it called "disp". when any of the links at the top of the page are clicked, a display(num) function is being triggered. i have a 2-d array called myKit where each array item stores multiple properties. the .js file for that can be found at http://www.nimlok.com/rent_search/tst1/alttxt1.js the number passed to teh function is the number for the "opt" property of the array entrie. if they are the same, the image is to be written to the layer.
    images are supposed to be written in line, and a <br> to be inserted after every 4th image.
    Here's my javascript:
    Code:
    var txt
    
    //controller function
    function blank() {
    }
    
    function display(num) {
     txt = ""
     var count = 0
      for (i = 0; i < myKit.length; i++) {
       if (num == myKit[i].opt) {
        txt += "<a href=javascript:blank() onClick=window.open('print1.htm?" + i + "','theWin','width=350,height=350') onmouseover=writetxt(" + i + ") onmouseout=writetxt('out')><img src=../" + myKit[i].folder + "/" + myKit[i].kitn + ".gif border='0' width='85' height='65' class='small'></a> "
        count = count + 1
         if (count == 4) {
          txt += "<br>"
          count = 0
         }
         //else {
         // txt = txt
         //}
       }
      }
    
     if (document.layers) {
      document.disp.document.open()
      document.disp.document.write(txt)
      document.disp.document.close()
     }
     else {
      disp.innerHTML = txt 
     }
    }
    Now, in IE everything works just fine. In NS 4.7, however, each image is written on the next line plus a break is inserted after every 4th image.
    I have put 2 screenshots onine for you to see the results: http://www.nimlok.com/rent_search/tst1/ie.jpg - for IE http://www.nimlok.com/rent_search/tst1/ns.jpg - for NS
    I cannot figure out why the images would not get written in the same line in NS. Could anybody help?

    Thanks

    p.s. I hope i did not confuse anybody with my explanations. i really comes down to a simpler question why does a <br> get inserted between those images when it is not in the code?
    Last edited by valeria_vi; Apr 12, 2002 at 08:52.
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried using an alert to check if, for some
    really wierd reason, its actually putting a <br>
    in the line it inserts? (sorry if you covered this)

    i wonder if the "page-break-after" might come into
    play (CSS)

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Flawless_koder,

    I di an alert thing, and actually, the <br> itself is not there (i guess I should have mentioned it right away). my div is wide enough, and no "page-break-after" is specified anywhere in my css. here's the link to it: http://www.nimlok.com/rent_search/tst1/style.css
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to insert a table to get the spacing...


    Hese the sloppy code I threw together real quick,



    Code:
    function display(num) {
     txt = "<table>"
     var count = 0
      for (i = 0; i < myKit.length; i++) {
       if (num == myKit[i].opt) {
       if(count == 0){txt+="<tr>"}
       
        txt += "<td><a href=javascript:blank() onClick=window.open('print1.htm?" + i + "','theWin','width=350,height=350') onmouseover=writetxt(" + i + ") onmouseout=writetxt('out')><img src=../" + myKit[i].folder + "/" + myKit[i].kitn + ".gif border='0' width='85' height='65' class='small'></a></td>"
       
        count = count + 1
         if (count == 4) {
          txt+="</tr>"
          count = 0
         }
         //else {
         // txt = txt
         //}
       }
      }
    
      txt+="</table>"
     if (document.layers) {
      document.disp.document.open()
      document.disp.document.write(txt)
      document.disp.document.close()
     }
     else {
      disp.innerHTML = txt 
     }
    }

  5. #5
    long gone but not forgotten AljapaCo's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should work as Fly Swatter puts it!!
    Get back here and tell us!!

    Could be useful for future reference!
    T O B I A S - S T R A N D H | visit my site here
    OPERA7 /MSIE6 /FireFox 1.1/Win2000 /ADSL /17" Screen /1024x768
    god doesn't create genius, he clones me.............

  6. #6
    SitePoint Addict
    Join Date
    Mar 2001
    Location
    the windy city
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fly Swatter,

    thanks a ton!
    i did actually try doing a table thing, but i messed the code up a bit (put <tr> and </tr> in wrong places), but it wasn't until I saw your code that i realized it (i just assumed that tables did not get teh problem solved either).

    THANKS!!!
    Goals are dreams with deadlines
    -------------------------------------
    Nimlok Trade Show Displays Booths and Exhibits


Bookmarks

Posting Permissions

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