MyBB Community Forums

Full Version: Javascript Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ok, i have a html textarea box. Im making a link that inserts a premade posting format into the textarea.

code:
function AddItem(ItemID)
{
document.form.message.value=document.form.message.value+ItemID;
document.form.message.focus();
return;
}


If you to add default text, click the following links:  <a href="javascript: AddItem('text1');">Text1</a>&nbsp;<a href="javascript: AddItem('text2');">Text2</a>

This works great. Clicking "Text1" link adds "text1" to the textarea and text2 does the same. UNTIL, I want to add multiple lines to the posting format. If I want to put
text1:
text2:
text3:
into the <a href="javascript: AddItem('blahhhh');">blahh</a> link how would I do it?
\n is a linebreak in javascript i believe.
Thank youuuU!