Hello,
I am searching to find a script can insert hyperlink into textarea but have not recieved yet any good result.
Once, the search result was this thread in this forum:
[url]http://www.webdeveloper.com/forum/s…ad.php?t=109274
it was just what I needed but I could not use it in my script. because it promps well, but dose not insert the url given into textarea.
now I have included the html part of my page in which the javascript must function :
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html”>
<title>title</title>
</head>
<script language=”JavaScript”>
function insertUrl()
{
var url = prompt(“Enter the complete URL for the hyperlink”, ‘http://’);
var label = prompt(“Enter the title of the website”, “website”);
if (url && label)
document.short_story.value += ‘<a href=”‘+url+'”>’+label+'</a>’;
}
</script>
<form action=”add.php” name=”guest” method=”POST” onsubmit=”return check_fields()”>
<textarea name=”short_story” rows=”4″ cols=”95″ style=”font-family: Tahoma; font-size: 8pt; font-weight:bold”>
</textarea>
<input type=”button” id=short_story value=”Click to Insert Link” onClick=”insertUrl()”>
<input type=”hidden” name=”dosend” value=”yes”>
</table>
</form>
</br>
</body>
</html>
Now I ask any body could help me by changing that promp script so that it can insert hyperlink into textarea,id”short_story” and the result of insert should be :
<a target=”_blank” href=”url”>Link Title</a>
[U]This is what I found in this forum:
<script language=”JavaScript”>
function insertUrl()
{
var url = prompt(“Enter the complete URL for the hyperlink”, ‘http://’);
var label = prompt(“Enter the title of the website”, “website”);
if (url && label)
document.short_story.value += ‘<a href=”‘+url+'”>’+label+'</a>’;
}
</script>
[U]This is my textarea where the urls should be insert:
<textarea name=”short_story” rows=”4″ cols=”95″ style=”font-family: Tahoma; font-size: 8pt; font-weight:bold”>
</textarea>
[U]and this is the buton to call it :
<input type=”button” id=short_story value=”Click to Insert Link” onClick=”insertUrl()”>
…………..
Anybody could help me? Your help would be apreciated as I do not know scripts, but I have lost my time on this and my site is off!
Thanks a lot.
waiting for help.
regards,
afx