버튼을 클릭하면 새로운 HTML 페이지에 동적으로 자바 스크립트를 작성하려고하는데 다음과 같은 코드가 있습니다.자바 스크립트를 새로운 HTML 페이지에 동적으로 작성하기
내가 그러나 나는 "종결되지 않은 문자열 constamnt"를 얻을 이론 그렇게하려고 시도하는 오류를 얻고,이 작업을해야합니다 :
var html = '<!DOCTYPE html>\n'
html += '<html>\n'
html += '<head>\n'
html += '<script type="text/javascript">\n'
html += 'function testme() {\n'
html += 'alert("the test worked!")\n'
html += '}\n'
html += '</script>\n'
html += '</head>\n'
html += '<body>\n'
html += '</body>\n'
html += '</html\n'
window.open('','').document.write(html)