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