How to ouput multi-line html with variable into div using javascript? -


i want output multi line html variable div inside jquery never ouput block of code inside div! using variable inside is"itemname". 1 tell me why code doesn't out div ?

var sitecontents2 ="<li> + "       <iframe src='<iframe src='http://bsite.com/itemshow.php?"+itemname+"&title=ok&bgcolor=white' height=200 width=200 style='border: none;></iframe><br>+ "        <div class="details">+ "        <div class="title">+ "          <a href="/+itemname/">+itemname</a>+ "        </div>+ "        </div>+ "    </li> ";     document.getelementbyid("mydiv").innerhtml += sitecontents2;   </script>    </head>  <body>      <div id="mydiv"></div> 

your quotes , concats not correct. try this:

var sitecontents2 ="<li>" +   "       <iframe src='<iframe src='http://bsite.com/itemshow.php?"+itemname+"&title=ok&bgcolor=white' height=200 width=200 style='border: none;></iframe><br> "+ "        <div class='details'>"+ "        <div class='title'>"+ "          <a href='/"+itemname+"/'>"+itemname+"</a>"+ "        </div>"+ "        </div>"+ "    </li> ";   

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -