Thursday, August 26, 2010

A Simple Display and Clipboard Copy of HTML code.

The following code can be inserted anywhere inline or the JavaScript in the global theme. Any ‘anchor’ can be used to call the code with the ‘id’ of the tag that contains the code.  Care needs to be taken that the tag will properly render the html as converted HTML.

The Windows Live Writer allows HTML to be pasted into the screen and it will convert as shown below. 

Copy Code To Clipboard

<script language="jscript" type="text/jscript">
<!--
     function divout(ctl){
        Copied = crl.createTextRange();
        Copied.execCommand('Copy');
        return false;
    }
-->
</script>
<a onclick="return divout(divCode);" href="">Copy Code To Clipboard</a>
<div id="divCode">  html goes here </div>

No comments:

Post a Comment