Forum Moderators: open
I know enough about Javascript and PHP to get myself into trouble. lol
Here's my problem:
I've got a simple script to insert personalization tags into a
textarea used for creating and saving an email.
I'd like to have the tags inserted wherever the user places their
cursor(in case they decide to add a tag later), instead of the tag
being inserted at the end of the text.
Here's what I have so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Javascript test</title>
<script type='text/javascript'>
function inserttxt(id,symbol) {
var elem = document.getElementById(id)
var elemtext = elem.value
elem.value= elemtext + symbol
}
</script>
</head>
<body>
<textarea id='ta1'></textarea><br />
<a href='#' onclick='inserttxt("ta1",":)")'>:)</a><br />
<a href='#' onclick='inserttxt("ta1","%clickbank_button%")'>%clickbank_button%</a><br />
<a href='#' onclick='inserttxt("ta1","%register_page%")'>%register_page%</a>
<br /><br />
<textarea id='ta2'></textarea><br />
<a href='#' onclick='inserttxt("ta2",":)")'>:)</a><br />
<a href='#' onclick='inserttxt("ta2","%clickbank_button%")'>%clickbank_button%</a><br />
<a href='#' onclick='inserttxt("ta2","%register_page%")'>%register_page%</a>
</body>
<html>
==========================================
Any help will be GREATLY appreciated!
Warmest regards,
Jeff