|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Button onclick copy the text in textarea
hi,
i have 3 textareas and 3 buttons on a page.when i click the particular button the text inside the textarea should be copied.it is working but when i keep this in a for loop,it is not working iam using the following code.but when i click button and paste the text it displays 'undefined'.not copyin the text.any of your help will be appreciated thanks mrjameer <?php for($i=0;$i<=3;$i++) { ?> <textarea name="copytext1">ABCD</textarea><BUTTON onClick="ClipBoard1();">Copy to Clipboard</BUTTON> <br> <textarea name="copytext2">EFGH</textarea><BUTTON onClick="ClipBoard2();">Copy to Clipboard</BUTTON> <br> <textarea name="copytext3">IJKL</textarea><BUTTON onClick="ClipBoard3();">Copy to Clipboard</BUTTON> <br> <?php } ?> <TEXTAREA ID="holdtext" STYLE="display:none;"> </TEXTAREA> <SCRIPT LANGUAGE="JavaScript"> function ClipBoard1() { holdtext.innerText = copytext1.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); } function ClipBoard2() { holdtext.innerText = copytext2.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); } function ClipBoard3() { holdtext.innerText = copytext3.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); } </SCRIPT>
__________________
mrjameer |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Button onclick copy the text in textarea |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|