Sunday 15 January 2012

jquery - how to display images in a javascript Array -


I'm trying to display images in an array on the page but I'm facing difficulties

That JS

  var movieArray = [{title: "artist", image: "http://cmclove.org/img/sw_off_off.png"}, {title: "one Better life ", picture:" Http://cmclove.org/img/sw_off_off.png "}, {title:" abduction ", image:" http://cmclove.org/img/sw_off_off.png "}, { Title: "African cat", Image: "http://cmclove.org/img/sw_off_off.png"}, {title: "Angel Crest", Picture: "http://cmclove.org/img/sw_off_off.png "}, {Title:" R Stather ", picture:" http://cmclove.org/img/sw_off_off.png "}, {title:" Anonymous ", diagram:" http://cmclove.org/img/sw_off_off.png "}, {title : "A Dangerous Method", Image: "http://cmclove.org/img/sw_off_off.png"},]; For (var p in film array) {console.log (p + ':' + movie around [p] .title + '|' + movie around [p].); }   

There is a link to Bella

You are not inserting anything into the page.

A solution would be:

 for  (var p = 0; p & lt; movieArray.length; p ++) {$ ('Body'). Endend ('& lt; img src =' '+ movieArre [P]. Picture +' 'title = "' + movieArtre [P] .title + '" "& gt;'); }   

Demo:

No comments:

Post a Comment