babelfish
06-17-2002, 12:42 PM
hi peeps - in the html 2 jscript converter in my sig i cant get the function to remove \r (tab) spaces
any ideas:
<html>
<title>HTML - JAVASCRIPT CONVERTER</title>
<style type="text/css">
<!--
input {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; border:1px solid #333333; width:160px; padding-top:2px}
textarea {width:95%; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; background-color:#FFFFFF; padding:5px; border:1px solid #333333; height:55%}
p {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #333333}
-->
</style>
<script language="JavaScript">
<!--
function writeCode(html,syntax)
{
var code="var code=\"";
while (html.indexOf(" ")!=-1)
html=html.split(" ").join(" ");
html=html.split("\\").join("\\\\");
html=html.split("/").join("\\/");
html=html.split("\"").join("\\\"");
html=html.split("\r\r").join("\r");
html=html.split("\r").join("");
html=html.split("\n\n").join("\n");
if (syntax && syntax=="expanded") code+=html.split("\n").join("\\n\";\ncode+=\"");
else code+=html.split("\n").join("\\n");
code+="\";\n\ndocument.write(code)";
document.html.source.value=code;
document.html.convert.value=":: done ::";
document.html.convert2.value=":: done ::";
document.html.convert.onclick=null;
document.html.convert2.onclick=null;
}
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>
<body bgcolor="#dddddd" onLoad="document.html.source.focus()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%"> </td>
<td width="34%"><img src="img/html2javascript.gif" width="449" height="70"></td>
<td width="33%" valign="bottom">
<p>version 2.3<br />
updated 17.04.02</p>
</td>
</tr>
</table>
<form name="html">
<div align="center">
<textarea name="source" class="box" cols="60" rows="17"></textarea>
<br>
<br />
<input type="button" name="convert" value=":: convert (compact) ::" onClick="writeCode(document.html.source.value)">
<input type="button" name="convert2" value=":: convert (expanded) ::" title="editor mode" onClick="writeCode(document.html.source.value,'expanded')">
<input type="button" name="reset" value=":: reset ::" onClick="self.location.href=self.location.href">
<input type="button" name="clipboard" value=":: copy to clipboard ::" onClick="ctrlA(document.html.source)">
</div>
</form>
<p align="center">:: html2javascript converter by babelfish - based on code created by jopie ::</p>
thanks!
any ideas:
<html>
<title>HTML - JAVASCRIPT CONVERTER</title>
<style type="text/css">
<!--
input {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; border:1px solid #333333; width:160px; padding-top:2px}
textarea {width:95%; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; background-color:#FFFFFF; padding:5px; border:1px solid #333333; height:55%}
p {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #333333}
-->
</style>
<script language="JavaScript">
<!--
function writeCode(html,syntax)
{
var code="var code=\"";
while (html.indexOf(" ")!=-1)
html=html.split(" ").join(" ");
html=html.split("\\").join("\\\\");
html=html.split("/").join("\\/");
html=html.split("\"").join("\\\"");
html=html.split("\r\r").join("\r");
html=html.split("\r").join("");
html=html.split("\n\n").join("\n");
if (syntax && syntax=="expanded") code+=html.split("\n").join("\\n\";\ncode+=\"");
else code+=html.split("\n").join("\\n");
code+="\";\n\ndocument.write(code)";
document.html.source.value=code;
document.html.convert.value=":: done ::";
document.html.convert2.value=":: done ::";
document.html.convert.onclick=null;
document.html.convert2.onclick=null;
}
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>
<body bgcolor="#dddddd" onLoad="document.html.source.focus()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%"> </td>
<td width="34%"><img src="img/html2javascript.gif" width="449" height="70"></td>
<td width="33%" valign="bottom">
<p>version 2.3<br />
updated 17.04.02</p>
</td>
</tr>
</table>
<form name="html">
<div align="center">
<textarea name="source" class="box" cols="60" rows="17"></textarea>
<br>
<br />
<input type="button" name="convert" value=":: convert (compact) ::" onClick="writeCode(document.html.source.value)">
<input type="button" name="convert2" value=":: convert (expanded) ::" title="editor mode" onClick="writeCode(document.html.source.value,'expanded')">
<input type="button" name="reset" value=":: reset ::" onClick="self.location.href=self.location.href">
<input type="button" name="clipboard" value=":: copy to clipboard ::" onClick="ctrlA(document.html.source)">
</div>
</form>
<p align="center">:: html2javascript converter by babelfish - based on code created by jopie ::</p>
thanks!