Hi I have a overlay which has links in it.
Is it possible to get these links to open into another overlay on top because I want the original page with the links to stay open and not navigate to the clicked linked website?
_blank and popup options in the tag do not work because it's a standalone program and just makes the original overlay navigate to the clicked link.
Html or javascript it would have to be.
This is how it is at the moment
replaceBBCodeUrl: function(content, attribute) {
var url, regExpUrl, link;
if(attribute)
url = attribute.replace(/\s/gm, this.encodeText(' '));
else
url = this.stripBBCodeTags(content.replace(/\s/gm, this.encodeText(' ')));
regExpUrl = new RegExp(
'^(?:(?:http)|(?:https)|(?:ftp)|(?:irc)):\\/\\/',
''
);
if(!url || !url.match(regExpUrl))
return content;
this.inUrlBBCode = true;
link = '<a href="'
+ url
+ '" onclick="window.open(this.href , popup); return false;">'
+ this.replaceBBCode(content)
+ '</a>';
this.inUrlBBCode = false;
return link;
},
replaceBBCodeImage: function(url) {
var regExpUrl, maxWidth, maxHeight, link;
if(this.settings['bbCodeImages']) {
regExpUrl = new RegExp(
this.regExpMediaUrl,
''
);
if(!url || !url.match(regExpUrl))
return url;
url = this.stripTags(url.replace(/\s/gm, this.encodeText(' ')));
maxWidth = this.dom['chatList'].offsetWidth-50;
maxHeight = this.dom['chatList'].offsetHeight-50;
link = '<img class="bbCodeImage" style="max-width:'
+ maxWidth
+ 'px; max-height:'
+ maxHeight
+ 'px;" src="'
+ url
+ '" alt="" onload="ajaxChat.updateChatlistView();"/>';
if(!this.inUrlBBCode) {
link = '<a href="'
+ url
+ '" onclick="window.open(this.href , popup); return false;">'
+ link
+ '</a>';
}
return link;
}
return url;
},
replaceHyperLinks: function(text) {
var regExp;
if(!this.settings['hyperLinks']) {
return text;
}
regExp = new RegExp(
'(^|\\s|>)((?:(?:http)|(?:https)|(?:ftp)|(?:irc)):\\/\\/[^\\s<>]+)(<\\/a>)?',
'gm'
);
return text.replace(
regExp,
// Specifying an anonymous function as second parameter:
function(str, p1, p2, p3) {
// Do not replace URL's inside URL's:
if(p3) {
return str;
}
return p1
+ '<a href="'
+ p2
+ '" onclick="window.open(this.href , popup); return false;">'
+ p2
+ '</a>';
}
);
},
This is all the link related code. Thanks in advance.
答案 0 :(得分:0)
您是否正在寻找a[target]
- 属性?您可以在MDN
答案 1 :(得分:0)
你应该考虑使用ajax,例如:
$("#yourlink").click(function(e) {
e.preventDefault();
$.ajax({
type: "GET",
url: $(this).attr('href')
}).done(function(data) {
$('#youroverlay').html(data);
});
return false;
});