javascript - Stringifyed onClick event does not work -


i have event parses string contains button name , url.

than assign data button. , add on click event suppose open url in new window. on click event doe not work. window not show up. if url wrong open window , prompt mistake.

but in case when click botton not react. wrong on click event here: onclick=\"mywindow = window.open('partarray[1]', '', 'width=300,height=300');\". can't understand what.

here code

 <script>    ...    var checktype = partarray[0].split("+");    outputs = outputs + "  <input type='button' class='worddoctype' name='" + partarray[0] + "' value='" + partarray[0] + "' onclick=\"mywindow = window.open('partarray[1]', '', 'width=300,height=300');\" /> &nbsp;&nbsp;"    document.getelementbyid("demo").innerhtml=outputs;   </script>     <body>      ...     <div id="demo"></div>      ...    </body> 

partarray[1] not evaluated; browser should still open window url specified "partarray[1]" doubt want. try adding double quotes , concatenating when build html.

outputs = outputs + "  <input type='button' class='worddoctype' name='" + partarray[0] + "' value='" + partarray[0] + "' onclick=\"mywindow = window.open('" + partarray[1] + "', '', 'width=300,height=300');\" /> &nbsp;&nbsp;" 

if provide more context or code it'd easier see might going on. sure there not popup-blocker getting in way?


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -