COPY

d3a7h_1313

Registered
Имаше 1 код дето да кажем като имаме написано нещо в текстареа (<textarea>) и като натиснеш бутона ти копира написаното... Ако не разбирате за какво говоря питайте ако ми го дадете - +1
 
Код:
 <textarea name="copytext1">ABCD</textarea><BUTTON onClick="ClipBoard1();">Copy to Clipboard</BUTTON>

Код:
<SCRIPT LANGUAGE="JavaScript">

function ClipBoard1()
{
holdtext.innerText = copytext1.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}</SCRIPT>

Кажи дали става..?!
 
като гледам си го копнал от някъде ноооо ми кажи това <script в <хеад> ли да седи или къде... ?
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Javascript for one-click highlight and copy to clipboard</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" >
<meta http-equiv="Content-Style-Type" content="text/css" >
</head>
<body>

<script type="text/javascript">
function doact(d)
{
var doc = eval("document.readme."+d);
cp = doc.createTextRange();
doc.focus();
doc.select();
cp.execCommand("Copy");
}
</script>
<div>
<form name="readme" action="#">
<p style="float:left">
<textarea name="text1" cols="10" rows="2">
1. -Your basic HTML codes can be entered here.</textarea>
<br>
<input onclick="doact('text1')" type="button" value="Quote">
</p>

<p style="float:left">
<textarea name="text2" cols="30" rows="2">
2. -This textarea is the second textbox for copying.
2. -This textarea is the second textbox for copying.</textarea>
<br>
<input onclick="doact('text2')" type="button" value="Longer Quote">
</p>

<p style="float:left">
<textarea name="text3" cols="40" rows="2">
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.
3. -This textarea is to demonstrate the inclusion of the third textbox for copying.</textarea>
<br>
<input onclick="doact('text3')" type="button" value="Still A Longer Quote">
<br style="clear:both" />
</p>
<p style="clear:both" ></p>
<p><strong>Add Information To <em>This Work Area</em> To Build Your Posting</strong></p>
<p>
<textarea name="text4" cols="60" rows="8">
</textarea>
<br>
<input onclick="doact('text4')" type="button" value="Main Text area">
<input type="reset" value="Clear The Form">
</p>
</form>
</div>
</body>

</html>
 

Back
Горе