How do you get to show a plain text in an ASP? I want to show some html code (in the page), so that the user can copy and paste it (in their pages). But I want the "<" to be pasted as "<" and not like "<"... and all that stuff.
How can I do this?
Printable View
How do you get to show a plain text in an ASP? I want to show some html code (in the page), so that the user can copy and paste it (in their pages). But I want the "<" to be pasted as "<" and not like "<"... and all that stuff.
How can I do this?
You need use a <textarea> for your code, otherwise "<" and some other symbols will be replaced.
Do you have any example?
Give me a minute....
Here:
Code:<html>
<head>
<title>Code Sample</title>
</head>
<script language="JavaScript">
function copyContent(elID){
var el=document.getElementById(elID)
el.focus();
el.select();
document.execCommand('Copy');
alert("Code Copied!");
}
</script>
<body>
<textarea id="codeSamp" rows="10" cols="100" style="border:none;">This is a test <font face="tahoma">Tahoma</font></textarea>
<br><input type="button" value="Copy Code to Clipboard" onclick="copyContent('codeSamp')">
</body>
</html>