<Title> title </title>
<Input type = "button" name = "Submit" onClick = 'copytoclipboard () 'value = "copy the topic address and send it to friends on QQ/MSN">
<Script language = "javascript">
Function copyToClipBoard (){
Var clipBoardContent = "";
ClipBoardContent + = document. title;
ClipBoardContent + = "";
ClipBoardContent + = this. location. href;
Window. clipboardData. setData ("Text", clipBoardContent );
Alert ("Copied successfully, paste it on your QQ/MSN and recommend it to your friends ");
}
</Script>
<Script>
Function oCopy (obj ){
Obj. select ();
Js = obj. createTextRange ();
Js.exe cCommand ("Copy ")
}
</Script>
<Input onclick = "oCopy (this)" value = "content to copy! ">
<Script language = "javascript">
Function CopyUrl (target ){
Target. value = myimg. value;
Target. select ();
Js = myimg. createTextRange ();
Js.exe cCommand ("Copy ");
}
Function AddImg (target ){
Target. value = "[IMG]" + myimg. value + "[/img]"; (Note: Remove spaces after/in [/img)
Target. select ();
Js = target. createTextRange ();
Js.exe cCommand ("Copy ");
}
</Script>
<Input name = myimg type = hidden id = myimg value = "http://www.jb51.net"/>
<Input name = imgurl type = text size = 32 value = "http://www.jb51.net"/>
<Input type = button value = "Click here to copy the address of this site" onclick = "CopyUrl (imgurl);"/>
<P> if you like this site, recommend it to your friends! </P>
<Script type = "text/javascript">
Function copyText (obj)
{
Var rng = document. body. createTextRange ();
Rng. moveToElementText (obj );
Rng. scrollIntoView ();
Rng. select ();
Rng.exe cCommand ("Copy ");
Rng. collapse (false );}
</Script>
The following is a code snippet:
Copy codeThe Code is as follows:
<Span id = "tbid"> http://www.jb51.net </span>
[<A href = "#" onclick = "copyText (document. all. tbid)"> click to copy </a>] <br/>
<Span id = "tbid2"> http://www.jb51.net </span>
[<A href = "#" onclick = "copyText (document. all. tbid2)"> click to copy </a>] <br/>