HTML generation using JavaScript


/ Published in: JavaScript
Save to your folder(s)

Run in the FireBug console, and copy the output. An odd class is included for row striping, and the number of items can be controlled via the for loop.


Copy this code and paste it in your HTML
  1. var namesArray;
  2. var names = "Sophie Twigg\nJanine Rappa\nCharley Vidmar\nWillena Tesoro\nSherril Zinke\nAmerica Konkel\nThalia Blackburn\nCatarina Monts\nNanci Haubert\nLoise Blackstock\nLong Kluender\nDelsie Kendricks\nMaurine Mccollister\nMika Lofton\nCathie Woolwine\nLarissa Baumgartner\nChelsey Mellott\nJere Lai\nAntonia Koth\nOlympia Selzer\nLatrisha Points\nSherrill Lis\nDemetrius Bien\nRobbie Leto\nGricelda Farlow\nTia Mcmillin\nPam Isakson\nDaisy Paden\nChaya Dejohn\nAmberly Mizer\nJanna Walcott\nDaphne Griffing\nRoselee Brunton\nShaunta Sylva\nLashaun Weisman\nWaneta Zaugg\nMarry Lafata\nReta Sobus\nNorine Curran\nNolan Manzione\nRutha Quesnell\nPercy Michell\nMaryalice Riemann\nLeif Welte\nMasako Charbonneau\nCleveland Dewolf\nErna Boddie\nGlenn Marler\nTerrilyn Coryell\nChrissy Wren\nCordia Lizardo\nMelissia Golan\nNatosha Marc\nDreama Helbig\nNenita Neubert\nWilbur Hetrick\nNadia Mell\nLoida Goens\nDalene Irle\nKatrina Rockefeller\nMarti Asselin\nKeira Whalley\nRonny Haning\nParker Piacente\nWendie Santigo\nJeremy Kantrowitz\nTeena Hemmings\nLuciano Argentieri\nNita Streater\nFidela Oberman\nDaniella Strawder\nPhyliss Inclan\nCalvin Flory\nInez Hinderman\nRosalind Berns\nTyson Brooker\nMaryjo Ro\nLorilee Jiang\nChing Sturtevant\nLyda Panetta";
  3.  
  4. namesArray = names.split("\n");
  5.  
  6. for(i=200; i < 270 ; i++){
  7. j = i-199
  8. if(i%2){
  9. oddClass = ' class="odd"';
  10. }else{
  11. oddClass = '';
  12. }
  13. console.log('<li'+oddClass+'><input id="id_'+i+'" type="checkbox" name="'+i+'" /><label for="id_'+i+'">'+namesArray[j]+'</label></li>');
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.