|
-
Mar 1st, 2006, 03:05 PM
#1
Thread Starter
Lively Member
javascript, Auto insert into input/textarea
Code:
<html>
<head>
<script type="text/javascript">
function writeStuff(theform, theinput, code)
{
var cache = document.theform.theinput.value;
document.theform.theinput.value = cache + " " + code + " ";
document.theform.theinput.focus();
}
</script>
</head>
<body>
<form name="sform" method="post" action="">
<textarea name="message" cols="15" rows="15"></textarea><br /><br />
<input type="button" onClick="writeStuff('sform','message','STRING HERE');" name="" />
</form>
</body>
</html>
My problem when I click the button, it doesnt add 'STRING HERE' to the textarea, this function worked perfectly before I attempted to make it universal with some arguments like theform and theinput, can anyone give me a hint on whats wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|