QUOTE
How did you add að URL link with target="_blank"? Could you show me the code?
I added this to mine:
CODE
function insertLink2 () {
if (!document.selection) return;
var str = document.selection.createRange().text;
if (!str) return;
var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
if (my_link != null)
var my_target = prompt('<MT_TRANS phrase="Enter Target:">', '_');
if (my_target != null)
var my_title = prompt('<MT_TRANS phrase="Enter Title:">', '');
if (my_title != null)
document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}
along with this:
CODE
document.write('<td width="33"><a href="javascript:insertLink2()"><img src="<TMPL_VAR NAME=STATIC_URI>images/url-button2.gif" alt="link2" width="33" height="18" border="0"></a></td>');
for the button to display on my toolbar, as I don't ALWAYS use _blank. The button for it is in the zip file in the post before this one.
Now - you could *also* simply change this:
CODE
function insertLink () {
if (!document.selection) return;
var str = document.selection.createRange().text;
if (!str) return;
var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
if (my_link != null)
document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}
to this:
CODE
function insertLink () {
if (!document.selection) return;
var str = document.selection.createRange().text;
if (!str) return;
var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
if (my_link != null)
var my_target = prompt('<MT_TRANS phrase="Enter Target:">', '_');
if (my_target != null)
document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}
and that would do it. This code will prompt you for a target when you click your URL button but it doesn't include any of the other stuff in the zip file in my other post.
I added the _ mostly for my own convenience, but you can leave that out.
I guess that's it!
KW