smrlnarisetty
asked on
how do I insert html in textarea
Hi,
My requirement is to insert HTML text in a textarea in one form[it could contain <a href...>cc</a>....<b>..</b > etc] and to be able parse the HTML and show the links in another textarea..in another form...so that the user can click the links...
How do I achieve this..
Thanks
Ram.
My requirement is to insert HTML text in a textarea in one form[it could contain <a href...>cc</a>....<b>..</b
How do I achieve this..
Thanks
Ram.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/11827220/Embed-an-actual-Href-within-a-textarea-within-a-form.html
i got the answer from the above:
<script>
/* Links script
(c) 2000 Michel Plungjan michel@irt.org */
function translate() {
text = document.myForm.myArea.val ue
newText = "";
if (text.indexOf('link:') !=-1) {
myLinks = text.split('link:')
for (i=0;i<myLinks.length;i++) {
if (myLinks[i]) newText += myLinks[i] +
'\n<a href="' + prompt('href for >'+myLinks[i]+'< ?','href="http://">http://') + '">' + prompt('text for >'+myLinks[i]+'< ?',myLinks[i])+'</a>';
}
text = newText;
}
else newText = text;
alert(text);
}
</script>
Dont ask me what it means, i thought it might help
i got the answer from the above:
<script>
/* Links script
(c) 2000 Michel Plungjan michel@irt.org */
function translate() {
text = document.myForm.myArea.val
newText = "";
if (text.indexOf('link:') !=-1) {
myLinks = text.split('link:')
for (i=0;i<myLinks.length;i++)
if (myLinks[i]) newText += myLinks[i] +
'\n<a href="' + prompt('href for >'+myLinks[i]+'< ?','href="http://">http://') + '">' + prompt('text for >'+myLinks[i]+'< ?',myLinks[i])+'</a>';
}
text = newText;
}
else newText = text;
alert(text);
}
</script>
Dont ask me what it means, i thought it might help
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
grade C, what did we do wrong? oh well, thanks anyway for the points :o)
ASKER