Skip to content

Instantly share code, notes, and snippets.

@ihower
Created January 16, 2009 16:24
Show Gist options
  • Save ihower/47985 to your computer and use it in GitHub Desktop.
Save ihower/47985 to your computer and use it in GitHub Desktop.
(function($) {
$(document).ready(function() {
$('#bd').click(function(event) {
var target = $(event.target);
if (target.attr('rel') == 'external') {
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
else {
var oWin = window.open(target.attr('href'), '_blank');
if (oWin) {
if (oWin.focus) oWin.focus();
return false;
}
oWin = null;
// return true;
}
}
// return true;
});
});
})(jQuery);
<a href="/foobar" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', '6f8fdqweqwea'); f.appendChild(s);f.submit();return false;" title="發佈活動"><img alt="Lightbulb" src="http://cdn.registrano.com/images/silk/lightbulb.png?1231141140">發佈活動</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment