a link 标签的disabled属性实现disabled/enable

由于a link是disabled属性设置成true,只是颜色变灰色但是还能提交.要想不能提交,可以删除href属性:

disable link

function disableLink(link) {
	//link.disabled = true;   
	link.setAttribute("disabled",true); 
	link.removeAttribute('href');   
}

enable link

function enableLink(link,href) {
	link.setAttribute("disabled",false);   
	link.setAttribute("href",href);   
}


你可能感兴趣的:(a link 标签的disabled属性实现disabled/enable)