Results 1 to 3 of 3
Related
-
PHP script running when page loads Forum: PHP Forum
Replies: 1 -
Expired Domains with Page Rank Script Website for Sale. Forum: Websites For Sale
Replies: 0 -
Perl Script to Receive http post and forward to an .aspx page Forum: CGI Perl Forum
Replies: 0 -
Passing variables from HTML page to page Forum: HTML Forum
Replies: 1 -
Getting a blank page while returning from page with form Forum: PHP Forum
Replies: 2
-
10-23-2003, 10:33 PM #1
Need help with duplicating a script on the same page
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> </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> </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> </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> </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> </td></tr>
<tr><td><table cellpadding=8 cellspacing=0 border=0 width=650 bgcolor=#DCDCDC><tr><td class=body><b>Conversion Counte</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> </td><td align=right>
<input type="button" value="Copy" onClick="copytext();"></td></tr>
</table></td></tr>
</table></td></tr></form>
-
10-28-2003, 06:02 PM #2
Originally Posted by RageDNA
Welcome to the forum.
What you want is to change those functions to accept a parameter. I would even combine them into one. Also, you'll need to have different names for each form and input, those duplicate names will confuse the browser DOM table.
Your script will look something like this :
HTML Code:<SCRIPT LANGUAGE="JavaScript"> <!-- var sp = window.location.hostname; function find_by_id(id) { if (!document.getElementById) { return document.all[id] } else { return document.getElementById(id); } } function copytext(objId) { var obj=find_by_id(objId); obj.select(); obj.focus(); textRange = obj.createTextRange(); textRange.execCommand("RemoveFormat"); textRange.execCommand("Copy"); } //--> </SCRIPT> <form name=cctext> <textarea name=text2copy_a cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box</textarea> <input type="button" value="Copy" onClick="copytext('text2copy_a');"> </form> <form name=cctext2> <textarea name=text2copy_b cols=50 rows=10 wrap=virtual readonly>Just Testing the copy box</textarea> <input type="button" value="Copy" onClick="copytext('text2copy_b');"> </form>
Last edited by HTML; 10-31-2003 at 04:56 PM.
-
10-28-2003, 06:13 PM #3
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum