When a Hyperlink element is set with an onclick handler, after passing through the Preview mode it is being stripped under IE7. Also related problem is that the link in the Preview mode are clickable and the URL set to the href attribute is opened in new tab/window.
Possible solution for both bugs is to override the function responsible for the conversion of such attributes in the Preview mode with this JavaScript code:
Telerik.Web.UI.Editor.Utils.setTargetsForPreview = function (editor) {
var contentArea = editor.get_contentArea();
var links = contentArea.getElementsByTagName("A");
for (var i = 0, l = links.length; i < l; i++) {
var link = links[i];
//handle targets
var target = link.getAttribute("target");
if (target != null) {
link.setAttribute("re_target", target);
}
if (target != "_blank")
link.setAttribute("target", "blank");
//handle ckick event
var oldOnClick = (link.getAttributeNode('onclick')
&& link.getAttributeNode('onclick').value)
|| link.getAttribute("onclick");
if (oldOnClick != null) {
link.setAttribute('re_onclick', oldOnClick);
}
link.setAttribute('onclick', 'return false;');
if (typeof link.onclick === "string") {
link.onclick = function () {
return false;
};
}
}
};
Telerik.Web.UI.Editor.Utils.restoreTargetsAfterPreview = function (editor) {
var contentArea = editor.get_contentArea();
var links = contentArea.getElementsByTagName("A");
for (var i = 0, l = links.length; i < l; i++) {
var link = links[i];
//handle targets
var oldValue = link.getAttribute("re_target");
if (oldValue != null && oldValue != "null") {
link.setAttribute("target", oldValue);
}
else {
link.removeAttribute("target");
}
//handle anchors urls
var oldOnClick = link.getAttribute("re_onclick");
link.onclick = null;
if (oldOnClick != null && oldOnClick != "null") {
link.setAttribute('onclick', oldOnClick);
}
else {
link.removeAttribute("onclick");
}
link.removeAttribute("re_onclick");
link.removeAttribute("re_target");
}
};
Note that this script must be placed in a script tag right after the RadEditor control.