-2
你可以幫助我與加號「+」的含義之前和之後myUrl在功能.not。爲什麼+在屬性href功能。不
它可以正常使用+或無+,所以爲什麼這本書使用它們?
<script type="text/javascript">
$(document).ready(function() {
$('a[href^="http://"]').each(function() {
var href = $(this).attr('href');
$(this).after(' {' + href + '}');
});
//$('a[href^="http://"').attr('target','_blank');
var myUrl = location.protocol + '//' + location.hostname;
$('a[href^="http://"], a[href^="https://"]').not('[href^="' + myUrl + '"]').attr('target', '_blank');
});
</script>
我懷疑它沒有使用'+'。 ['+'執行*字符串連接*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition_())。 –
RTFM請,_ + _是JavaScript級聯標誌.. –
絕對沒有'+' –