function ctrlA(el) {
with(el){
focus(); select()
}
if(document.all){
txt=el.createTextRange()
txt.execCommand("Copy")
window.status='Selected and copied to clipboard!'
document.html.clipboard.value=":: copied ::";
}
else window.status='Press ctrl-c to copy the text to the clipboard'
setTimeout("window.status=''",3000)
}
//-->
</script>
</head>
\r is a carriage return. \t is a tab. i'm thinking that's your problem.
by the way, i've meant to suggest it before, but forgotten. if you wrap the html in single qoutes ( ' ), then you don't have to escape the double quotes.
erm, tried that and it dont work :(
any ideas?
and i didnt change the " and ' cos im carp @ jscript :)
although if that was an offer i will gladly accept :)
that was my only idea. i do know for a fact though, that tab is \t, and not \r. i double checked the Guide (http://www.oreilly.com/catalog/jscript4/) on that.
i got a couple of projects right now, but later, if you want, i'll take a look at helping you switch the quotes around.
i might hold you to that ;) and trying to workaround the document.write and style= NS4.7 bug
(try to get document.write (*style=*) to work :) )
ok, i did the following to your code. i haven't had the chance to test it at all, so don't throw what you have away in favor of this.
i changed it to use the replace() method of Strings, instead of the split/join combo you had. also, i tried changing the quote marks around. the places where i changed it are in red. supposing those changes work, you could delete the line in bold, as unnecessary.
hope this helps.
function writeCode(html,syntax)
{
var code="var code='";
while (html.indexOf(" ")!=-1) {
html.replace(/\u0020\u0020/g," ");
}