I am attempting to create a HTA application with the following functionality
1) the user clicks a button
2) a popup containing multiple textareas pops up
3) the user then enters information into the textareas
4) the user then clicks a ‘Do something’ button in the popup window (not incl in code)
5) the JavaScript in the application does something with the data (not incl in code)
I stuck on the third point. The show_popup function uses .innerHTML to place the inputText div element inside the popup window.
However when it does this, it brings the textarea through in a read only type fashion where it will not allow me to input text.
It would be greatly appreciated if anyone has any input as to how to fix this.
my code is as follows
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<HTA:APPLICATION/>
<script type="text/javascript">
function show_coords(event)
{
var x=event.screenX + document.body.parentNode.scrollLeft - window.screenLeft;
var y=event.screenY + document.body.parentNode.scrollTop - window.screenTop;
document.getElementById('coordVarX').value = x;
document.getElementById('coordVarY').value = y;
}
function show_popup(divId,winWidth,winHeight)
{
var p=window.createPopup();
var pbody=p.document.body;
var x = document.getElementById('coordVarX').value;
var y = document.getElementById('coordVarY').value;
pbody.style.border="solid black 1px";
pbody.innerHTML=divId.innerHTML;
p.show(x,y,winWidth,winHeight,document.body);
}
</script>
</head>
<body onmousedown="show_coords(event)">
<textarea id="coordVarX" name="coordVarX" value="" style="display:none;"></textarea>
<textarea id="coordVarY" name="coordVarY" value="" style="display:none;"></textarea>
<button onclick="show_popup(inputText,150,30)">Enter text</button>
<div id="inputText" style="display:none;">
<span>
<form>
<input type="textarea" value=""></input>
</form>
</span>
</div>
</body>
</html>
Many thanks!
You need
<textarea></textarea>– not input type=textarea