Some problems in your code mentioned above which I colored in red
Code:
<!-- HIDE FROM INCOMPATIBLE BROWSERS
function Jumble()
{
var input = document.forms[0].description.value;
var split = input.split(", ");
var output = "";
for(i=0; i < split.length; i++;)
{
if( i != 1 - split.length)
output = output + "-" split[i] + "<br />\n\n";
else
output = output + "-" split[i] + "<br />";
}
document.forms[0].description.value = output;
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body>
<form >
<p>Description Formater<br />
<textarea name="description" cols="50" rows="30" /></textarea> </p>
<p><input type="button" value="Format" onclick="return Jumble();" /> </p>
</form>
1.
Code:
if(i != 1 - split.length)
The condition seems to be illogical from your scripts point of view. Is it some thing like the following
Code:
if(i != (split.length - 1))
2.
Code:
output = output + "-" split[i] + "<br />\n\n";
This must be the following
Code:
output = output + "-"+split[i] + "<br />\n\n";
3.
Code:
output = output + "-" split[i] + "<br />";
This must be the following
Code:
output = output + "-"+split[i] + "<br />\n\n";
4.
Code:
for(i=0; i < split.length; i++;)
This must be the following
Code:
for(i=0; i < split.length; i++)
I would suggest not using built-in method names as your variable.
Bookmarks