How to get text from javascript alert box
Posted: 25 Feb 2020, 20:04
Good evening (dutch-time) I have a javascript what can copy text to a clip-board + it has a button to show the item-list in a alert-box.
But can`t find out how I can select the text from the alertbox.
Hope you can help me out.... ?
But can`t find out how I can select the text from the alertbox.
Hope you can help me out.... ?
Code: Select all
<body>
<table WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
<td align="center">
<table width="100%">
<tr>
<td WIDTH="100%" align="center"><form name="history">
<p><font
face="ARIEL,HELVETICA" SIZE="-1"><input name="command" type="text" value size="20"> <input type="button"
value="Add to List" onclick="f_store(document.history.command.value)"> <input
name="history" type="button" value="Show List" onclick="f_print()"> </font> </p>
</form>
<p align="center"><font
face="ARIEL,HELVETICA" SIZE="-1"><script language="JavaScript">
<!-- hide it ...
function MakeArray( n ) {
if( n <= 0 ) {
this.length = 0;
return this;
}
this.length = n;
for( var i = 1; i <= n; i++ ) {
this[ i ] = 0;
}
return this;
}
var history = new MakeArray( 15 );
var index = 0;
var cmmnd = 1;
function f_store( sTR ) {
var i;
if( index >= history.length ) {
for( i = 1; i < history.length; i++ )
history[i-1] = history[i];
index = history.length - 1;
}
history[ index ] = cmmnd + ":" + sTR;
++cmmnd;
++index;
document.history.command.value="";
}
function f_print() {
var allCmmnds, i;
allCmmnds = "";
for( i = 0; i < index; i++ )
allCmmnds += history[i] + "\n";
alert( allCmmnds );
}
</script>