TheTaoOfBill
Programmer
I guess it's been too long since I've brushed up on my Javascript because something that seemed simple became very difficult very fast.
Basically I am trying to create a formater in javascript. I post listings on ebay for a living and part of the job involves copying a few lines of description and pasting it into the ebay description and formating it to be seperated by lines with a dash before it. The original description has things seperated by commas and I want to be able to copy the whole thing and input it into the program and have it come out in html with a dash before it and a line break at the end. This would cut my work time in half. I know it is very possible in Javascript. In fact I did something like this before. But I just can't seem to get it to work this time. This is the code I made.
Everything looks fine to me but when I run it I get an error in the java console saying the Jumble function is not defined. But as far as I can tell it is defined. I am guessing there is something wrong with the code within the function. But I can't really figure out what I did wrong. I'm just really rusty I guess. Can someone help me out?
Basically I am trying to create a formater in javascript. I post listings on ebay for a living and part of the job involves copying a few lines of description and pasting it into the ebay description and formating it to be seperated by lines with a dash before it. The original description has things seperated by commas and I want to be able to copy the whole thing and input it into the program and have it come out in html with a dash before it and a line break at the end. This would cut my work time in half. I know it is very possible in Javascript. In fact I did something like this before. But I just can't seem to get it to work this time. This is the code I made.
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>