html:
<a href="javascript:void(0)" οnclick="update(this)">上架</a>
js:
function update(obj){
if(obj.innerText=="上架"){
obj.innerText="下架"
}else{
obj.innerText="上架"
}
}
jquery:
function update(obj){ if($(obj).text()=="上架"){ $(obj).text("下架"); }else{ $(obj).text("上架"); } }