<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
#text{
width: 300px;
height: 150px;
}
</style>
<script>
var textWindow;
function openWindow(){
textWindow = window.open("","Введите текст:","top=100,left=100,width=400,height=200");
textWindow.document.body.innerHTML = "<input type='text' value='Текст' id='input'>" +
"<input type='button' value='Ввести'" +
" onclick='window.opener.enter(document.getElementById(\"input\"))'>"; }
function enter(textInput){
var textOutput = document.getElementById("text");
textOutput.value = textInput.value;
textWindow.close();
}
</script>
</head>
<body>
<form>
<textarea id="text"></textarea>
<input type="button" value="Открыть окно" onclick="openWindow()">
</form>
</body>
</html>
Это если окно не модальное а если надо модальное то используйте:
var text = prompt("Введите текст","Текст");