I have a pop-up window that shows some text. User wants to be able to click on the window, click “Control-A” (to select all text), then copy the text. When they do “Control A” it selects all of the text in the browser. Is there any way to do this?
Here is how I construct the window (simplified for this post):
dhxWins = new dhtmlXWindows();
win = dhxWins.createWindow("PackageSource", 0, 0, 600, 600);
win.centerOnScreen();
win.setModal(false);
win.denyPark();
win.clearIcon();
win.button("close").attachEvent("onClick",function() {
win.hide();
});
win.setText("Show Package Source");
win.show();
var pkgsourcediv = document.getElementById('pkgsourcediv')
win.attachObject(pkgsourcediv);
var textarea = document.getElementById('pkgsourcetxt');
if (textarea.outerHTML)
textarea.outerHTML = '<pre id="pkgsourcetxt">'+ result +'</pre>';
else
textarea.innerHTML = result;
Where the DIV we’re attaching is:
<div id="pkgsourcediv" style="width:100%;height:100%;overflow:auto;display:none;">
<pre id='pkgsourcetxt'></pre>
</div>