Hi!
Sorry for my bad english!
I want to make a function that will replace "[LINK=url]Some text[/LINK]" with "<a href=url>Some text</a>".
I tried, but the code is too long. Is there any shorter code for this.
Here's how I do this (but this code make only first [LINK] into <a href...>)
<script type="text/javascript">
function links(){
text = document.getElementById('tekst').value;
linkOpen = text.indexOf("[LINK=");
linkClose = text.indexOf("[/LINK]");
len = text.length;
forLink = text.substring(linkOpen,linkClose);
linkA = forLink.split("]");
linkB = linkA[0];
linkText = linkA[1];
linkB = split("=")
link = linkB[1];
linkClose += 7;
part_1 = text.substring(0,linkOpen);
part_2 = text.substring(linkClose,len);
all = part_1 + "<a href=" + link + ">" + linkText + "</a>" + part_2;
}
</script>