CarlosTheDwarf Posted July 22, 2008 Share Posted July 22, 2008 Alright so I have an array that holds the code to display certain images and I want to display them four or five across.I have tried all of the following ways and they all display both pictures, but on new linesdocument.write(images[0], images[1]);------------------------------------------document.write(images[0] + images[1]);-----------------------------------------display = new String(images[0], images[1]);document.write(display);--------------------------------------------display = new String(images[0] + images[1]);document.write(display); Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 22, 2008 Share Posted July 22, 2008 Set each image to display inline first, like so: images[0].style.display = 'inline';images[1].style.display = 'inline'; The default display value for images is 'block' which automatically breaks the line. Link to comment Share on other sites More sharing options...
jeffman Posted July 22, 2008 Share Posted July 22, 2008 Block? You sure? I just tested a little script like above and my images came out inline, as they do when I'm not document.writing. I used strict and transitional, just to be sure. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title></title> </head> <body> <script type="text/javascript"> s1 = '<img src="kiss.gif" alt="">'; s2 = '<img src="kiss.gif" alt="">'; document.write(s1 + s2); </script> </body> </html> Carlos, could you maybe be storing something in images[0] etc. that's causing this? What IS in images[0]? Does your style sheet have any declarations that could be interfering? Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 22, 2008 Share Posted July 22, 2008 Hm. My memory has probably betrayed me then.How big are the images? Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 22, 2008 Author Share Posted July 22, 2008 140 x 118 Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 22, 2008 Share Posted July 22, 2008 I didn't mean to replace Dad's questions but to add to them; please answer those as well. Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 22, 2008 Author Share Posted July 22, 2008 Right Right i didnt see them sorry. I didnt really use much css, just to set the background and link colors. all the images values are just files paths that i dont really want to post to be honest but i dont see why they would change anything. I am using though Dreamweaver which might automatically change things to different defualts.I tried setting them to inline but they stopped showing up all together. is there something else I need to add for this to work? Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 22, 2008 Share Posted July 22, 2008 I just tried putting 2 IMG elements side-by-side directly into the HTML (definitely quirks mode - no DOCTYPE) and they worked fine. You can try restricting the width of the images and maybe that will fix it; otherwise, we need some demonstration code. Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 23, 2008 Author Share Posted July 23, 2008 Alright Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 23, 2008 Author Share Posted July 23, 2008 Block? You sure? I just tested a little script like above and my images came out inline, as they do when I'm not document.writing. I used strict and transitional, just to be sure.<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title></title> </head> <body> <script type="text/javascript"> s1 = '<img src="kiss.gif" alt="">'; s2 = '<img src="kiss.gif" alt="">'; document.write(s1 + s2); </script> </body> </html> Carlos, could you maybe be storing something in images[0] etc. that's causing this? What IS in images[0]? Does your style sheet have any declarations that could be interfering? wow i totally missed it when you suggested it but im pretty sure you were right. i think i had a line break in the array values because i just started from scratch and redid the whole thing and it is working right now. and now that i think back im pretty sure i recall one in there. Good Call. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.