Skip to main content

Thread: inserting sequential divs


i trying solve following.

have box...
code:
#box {width:100px; height:50px;}
...into i'd insert/append...
code:
#frame0,  #frame1,  #frame2 {float:left; margin:5px auto 0 5px; width:30px; height:30px;}
...which ready accept...
code:
var photo=new array();  photo[0]="image0.jpg";  photo[1]="image1.jpg";  photo[2]="image2.jpg";  var lenp=photo.length;
...using following method:
code:
function insert_images()  {  (i=0; i<lenp; i++)  {  document.getelementbyid("box").innerhtml='<div id="frame'+i+'">'+photo[i]+'</div>';  }  }
the result see is, roughly:
code:
<div><box><div><frame2><image2></div></div>
the result shooting is:
code:
<div><box>  <div><frame0><image0></div>  <div><frame1><image1></div>  <div><frame2><image2></div>  </div>
perhaps analogy helps clarify after.
code:
cat photo0 photo1 photo2 >> box_frame
...when 1 opens box_frame 1 finds...
code:
image0 image1 image2
...and not just:
code:
image2
thanks insight.

your code replaces innerhtml instead of appending it...


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] inserting sequential divs


Ubuntu

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues