script type="text/javascript">
function disp_prompt()
{
var name=prompt("Please enter your name","Harry Potter");
if (name!=null && name!="")
{
document.getElementById('txtarea').value += name;
}
}
</script>
<input type="button" onclick="disp_prompt()" value="Display a prompt box" />
<textarea id='txtarea'></textarea>