...

View Full Version : Noob Question - Multiple Scripts?



xzile609
08-30-2010, 07:56 PM
I would like to use this code for multiple object on a single page.


<SCRIPT LANGUAGE="JavaScript">

function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}

</SCRIPT>




<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
Text of stuff
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>



The problem is im not sure how to get more than 1 SPAN ID to work with the script. any help would be great!

Lerura
08-31-2010, 03:00 AM
<SCRIPT LANGUAGE="JavaScript">

function ClipBoard(SpanID)
{
holdtext.innerText = SpanID.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}

</SCRIPT>


<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
Text of stuff
</SPAN>
<SPAN ID="copytext2" STYLE="height:150;width:162;background-color:pink">
Stuff to text
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard(copytext);">Copy to Clipboard</BUTTON>
<BUTTON onClick="ClipBoard(copytext2);">Copy to Clipboard</BUTTON>

Lerura
08-31-2010, 03:11 AM
And you have another problem:
innerText is IE-only!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum