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');\" /> " 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');\" /> "
if provide more context or code it'd easier see might going on. sure there not popup-blocker getting in way?
Comments
Post a Comment