Board Thread:Support Requests - Getting Technical/@comment-2112998-20130125015527

Hello,

I'm trying to use a JavaScript code from Wookieepedia to the Star Wars Wiki (portuguese) and I'm having some difficulties. Wookieepedia editor's code has only one textarea tag (probably because they have disabled the WYSIWYG mode). What I need is to get a JavaScript function working in my wiki, which editor's code has two textareas. This function inserts certain text in the article's code (changing the textarea's value). Here's the function I'm talking about.

function insertAtCursor(myField, myValue) { //IE support if (document.selection) {		myField.focus; sel = document.selection.createRange; sel.text = myValue; }	//MOZILLA/NETSCAPE support else if(myField.selectionStart || myField.selectionStart == '0') {		var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); }	else {		myField.value += myValue; } }

What can I do? 