Click to See Complete Forum and Search --> : Need with duplicate a script on the same page.


RageDNA
10-16-2003, 12:55 PM
Hello, I'm new here...

I would like to ask for some help on duplicating this script so that I can have up to 10 or more copy boxes on one webpage.

The script is a simple copy script but I'm not sure of to get it to copy from each different box on the same page. I put three boxes in the script below. Now I just need to get the scrip to copy the information from each box separately.

Please help.

Here is the script.


<SCRIPT LANGUAGE="JavaScript">
<!--

var sp = window.location.hostname;

function highlighttext() {
document.cctext.text2copy.select(); document.cctext.text2copy.focus();
}

function copytext() {
highlighttext();
textRange = document.cctext.text2copy.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}

//-->
</SCRIPT>


<form name=cctext>

<tr><td><p>&nbsp;</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box</textarea></td></tr>
<tr valign=top><td class=small>&nbsp;</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>

<form name=cctext>

<tr><td><p>&nbsp;</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box</textarea></td></tr>
<tr valign=top><td class=small>&nbsp;</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>

<form name=cctext>

<tr><td><p>&nbsp;</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box</textarea></td></tr>
<tr valign=top><td class=small>&nbsp;</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>

sciguyryan
10-16-2003, 03:11 PM
simple - repeate the script two more times and change the references as appropreate.

RageDNA
10-16-2003, 03:50 PM
OK I'm an extreme newbie. I tried a few things but still can't get it to work yet. Can you give me an example on how to change the references as appropriate or what it should look like?

Please and thanks

RageDNA

sciguyryan
10-17-2003, 11:24 AM
Ok, no problem - first you will have to have different names for each text input type.

RageDNA
10-17-2003, 12:35 PM
OK I did the following but when I click the first box it only copys the 3rd box.



:(


<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<SCRIPT LANGUAGE="JavaScript">
<!--

var sp = window.location.hostname;

function highlighttext() {
document.cctext.text2copy.select(); document.cctext.text2copy.focus();
}

function copytext() {
highlighttext();
textRange = document.cctext.text2copy.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--

var sp = window.location.hostname;

function highlighttext() {
document.cctext1.text2copy1.select(); document.cctext1.text2copy1.focus();
}

function copytext() {
highlighttext();
textRange = document.cctext1.text2copy1.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--

var sp = window.location.hostname;

function highlighttext() {
document.cctext2.text2copy2.select(); document.cctext2.text2copy2.focus();
}

function copytext() {
highlighttext();
textRange = document.cctext2.text2copy2.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}

//-->
</SCRIPT></head>

<body>

<form name=cctext>

<tr><td><p>_</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box 1</textarea></td></tr>
<tr valign=top><td class=small>_</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>

<form name=cctext1>

<tr><td><p>_</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy1 cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box 2</textarea></td></tr>
<tr valign=top><td class=small>_</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>

<form name=cctext2>

<tr><td><p>_</td></tr>

<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counter™</b></td></tr>
<tr><td class=body>To get started, please add the following HTML code to the
appropriate page on your Web site.<br><img src=/images/signup/clear.gif height=4 width=1 alt=""><br><table cellpadding=3 cellspacing=0 border=0>
<tr><td colspan=2><textarea name=text2copy2 cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box 3</textarea></td></tr>
<tr valign=top><td class=small>_</td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form></body>

</html>

sciguyryan
10-18-2003, 03:59 AM
Have you changed the references to the objec names? and, have you assigned each one to a different variable? if the later is not done then the scritp will over write all the previous ones - that is why you only get textbox - 3 to copy.

RageDNA
10-18-2003, 10:51 AM
hummm I think I did that didn't I?

Maybe I should get a freelancer to write the script for me. I can't seem to do it right and I've been working on this same script for a week now... lol...a newbie at work. I really don't want to pay someone for something that seems so simple.

I think my hair is turning gray now... :(

sciguyryan
10-18-2003, 02:59 PM
I will tyr but, i cant promise any think ok?

RageDNA
10-18-2003, 03:50 PM
Thank you for the help... I hope we can get this to work.

Again thank you.

RageDNA

RageDNA
10-23-2003, 09:38 PM
Bump....

I still need help....

Please

Thanks...

sciguyryan
10-25-2003, 03:54 AM
Sorry, I ahve been quite illl. But I am still looking for a solution - I will post what I have soon.