我正在尝试编写分页代码.一个功能是禁用当前链接,使其看起来像文本并且不可点击.在html页面中,这可以通过省略href属性来实现,如:
<a>Link</a>
Run Code Online (Sandbox Code Playgroud)
我不能在javaScript中这样做,
AvdonPagination.prototype.manageLinks = function(link){
if(link){
this.current.href = '#';
this.current = link;
}else{
this.current = this.links[0];
}
this.current.href = null;
}
Run Code Online (Sandbox Code Playgroud)
因为
this.current.href = null;
Run Code Online (Sandbox Code Playgroud)
产生
<a href="null">Link</a>
Run Code Online (Sandbox Code Playgroud)
我也试过了this.current.href="",this.current.disabled=true但是它们都不起作用.我怎么能实现<a>Link</a>?
这段代码有什么问题?
var sha = 6;
var secondParameter = dan || sha;
alert(secondParameter);
Run Code Online (Sandbox Code Playgroud)
我试过很多浏览器.没有警报.如果我像这样添加var dan:
var sha = 6;
var dan = 5;
var secondParameter = dan || sha;
alert(secondParameter);
Run Code Online (Sandbox Code Playgroud)
警报将会发生.那么"||"中的问题.我看到许多代码使用这样的运算符!所以我不知道..