Мне нужно создать объект document
в HTML-страницу, используя javaScript , чтобы выполнить новую HTML-страницу; так: Как создать документ Object в HTML-страницу?
<!DOCTYPE html>
<html>
<head>
... some head tags appened
<script>
// not problem of with jquery or not
function createDocument(){
var ta = document.getElementById('ta');
var targetElement = document.getElementById('targetElement')
// so i need to know how can use [ta.value]
// to execute it in new DOCUMENT Element appended it in [targetElement]
// without get or set global variables in origin document
}
</script>
</head>
<body>
<textarea id="ta"></textarea>
<div id="targetElement">
<!-- need to append new html document HERE! -->
</div>
<!--
when click the run Button the value of text area can be
running content to create new document object into targetElement
-->
<button onclick="createDocument()">RUN</button>
</body>
</html>
'createElementById'? Вы действительно смешиваете 'createElement' с' getElementById'? – undefined
попробуйте что-то вроде 'var ta = (document.createElement (" div ")) setAttribute (" id "," ta ");' – Downgoat
ops sorry yeah, я имею в виду 'getElementById' yeah – imel