I am using a Wordpress plugin for clickable smileys.
When a person comments on my blog, they can click the smiley they want and the code for it is transferred to the textbox.
This works in other browsers, the problem is only in Internet Explorer.
The developer is going to be fixing it, eventually. I'd like to try and fix it now so it at least works on my site.
The error is.
'window.opener.document' is null or not an object
Here is that area of the code.
Code:
function smileys(tag) {
tag = ' ' + tag;
var my_field;
if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
my_field = document.getElementById('comment');
} else if (window.opener.document.getElementById('content') && window.opener.document.getElementById('content').type == 'textarea') {
my_field = window.opener.document.getElementById('content');
} else if (window.opener.document.getElementById('comment') && window.opener.document.getElementById('comment').type == 'textarea') {
my_field = window.opener.document.getElementById('comment');
} else { return false; }
if (document.selection && !window.opera) {
my_field.focus();
sel = window.opener.document.selection.createRange();
sel.text = tag;
my_field.focus();
} else if (my_field.selectionStart || my_field.selectionStart == '0') {
var startPos = my_field.selectionStart;
var endPos = my_field.selectionEnd;
var cursorPos = endPos;
my_field.value = my_field.value.substring(0, startPos)
+ tag
+ my_field.value.substring(endPos, my_field.value.length);
cursorPos += tag.length;
my_field.focus();
my_field.selectionStart = cursorPos;
my_field.selectionEnd = cursorPos;
} else {
my_field.value += tag;
my_field.focus();
}
}
Thanks for any help!