I need to generate a string that reads like this...
Input text:
PETER
STEVE
JOHN
Output text:
PETER (1),
PETER (2),
STEVE (1),
STEVE (2),
I have previously generated a code that would string the input text together for another result but now need the output to look like above result.
that code was:
<script language="javascript">
function fix(starter)
{
var toReturn = "";
var data = document.getElementById("data").innerHTML;
var lines = data.split("\r\n");
toReturn = lines.join("', '");
toReturn = starter + "('" + toReturn + "')"
document.getElementById('answer').innerHTML = toReturn;
window.clipboardData.setData("text", toReturn);
alert('Copied to clipboard!');
}
</script>
<h2>COPY TO CLIP</h2>
<table>
<tr>
<td><b>ENTER:</b></td>
<td><textarea id="data" rows="10" cols="20"></textarea></td>
</tr>
<tr>
<td><b>SELECT:</b></td>
<td>
<input type="button" value="RESULT" onClick="fix('RESULT')">
</td>
</tr>
<tr>
<td><textarea id="answer" rows="10" cols="20"></textarea></td>
</tr>
</table>
}
Is there an easy way to do this change with out changing too much??
Please help as its doing my head in!