Ardor
10-30-2002, 02:23 PM
Hi,
I found a script on this page http://www.htmlgoodies.com/beyond/clipboard.html and would like some help in defining the variables.
If the script for one "copy to clipboard"-button goes like this:
<SCRIPT LANGUAGE="JavaScript">
function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}
</SCRIPT>
and the command for copying 1 piece of text goes like this:
<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
This 1st text will be copied onto the clipboard when you click the button next to the text.
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
How should I define the variables if I also want to have:
<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
This 2nd text will be copied onto the clipboard when you click the button next to the text.
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
on the same page???
Thanx for all your help!
Note: Please bear in mind that this is the first time I've ever used Javascript!
I found a script on this page http://www.htmlgoodies.com/beyond/clipboard.html and would like some help in defining the variables.
If the script for one "copy to clipboard"-button goes like this:
<SCRIPT LANGUAGE="JavaScript">
function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}
</SCRIPT>
and the command for copying 1 piece of text goes like this:
<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
This 1st text will be copied onto the clipboard when you click the button next to the text.
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
How should I define the variables if I also want to have:
<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
This 2nd text will be copied onto the clipboard when you click the button next to the text.
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
on the same page???
Thanx for all your help!
Note: Please bear in mind that this is the first time I've ever used Javascript!