View Full Version : Expanding this function to accomodate multiple items

08-05-2002, 06:11 PM
I have the following bit of code:

function ClipBoard()
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();


I use it to copy items to the clipboard. It works great when I only have one piece of information to deal with (one "holdtext", one "copytext").

I want to expand the capabilities of this function in order to accomodate more than one piece of information. Something that will allow me to pass it an integer ("ClipBoard(1);", or "ClipBoard(100334);") instead of it dealing with just one.


Mr J
08-05-2002, 06:35 PM
See if this does what you require.

function Copy(n){
textRange = document.body.createTextRange();

<a href="#null" onclick="Copy(copyit)">Copy To Clipboard</a>

<P><a href="#null" onclick="Copy(copyit2)">Copy To Clipboard2</a>

<P><div id=copyit>This would be the first text range to be copied</div>

<P><div id=copyit2>This is the second range of text to be copied by the same script

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum