href="javascript:xxx(this);"和onclick="javascript:xxx(this);"
一直以為這兩種寫法是等同的,不能傳入this作為參數(shù)
相關(guān)連接:http://www.111cn.net/wy/js-ajax/42275.htm
一直以為這兩種寫法是等同的,不能傳入this作為參數(shù)
相關(guān)連接:http://www.111cn.net/wy/js-ajax/42275.htm
2016-03-02
<p class="slide">
<a href="javascript:showdiv();" id="strHref" class="btn-slide" >展開</a> <!--點(diǎn)擊按鈕-->
</p>
<a href="javascript:showdiv();" id="strHref" class="btn-slide" >展開</a> <!--點(diǎn)擊按鈕-->
</p>
2016-02-22
function hidediv() {//收起函數(shù)
document.getElementById('hpn').style.display='none';
document.getElementById("strHref").href="javascript:showdiv();";
}
document.getElementById('hpn').style.display='none';
document.getElementById("strHref").href="javascript:showdiv();";
}
2016-02-22
function showdiv() {//展開函數(shù)
document.getElementById('hpn').style.display='block';
document.getElementById('strHref').innerHTML='收起-';
document.getElementById("strHref").href="javascript:hidediv();";
}
document.getElementById('hpn').style.display='block';
document.getElementById('strHref').innerHTML='收起-';
document.getElementById("strHref").href="javascript:hidediv();";
}
2016-02-22
var h=0;
function addh() {
if(h<300) {
h+=5;
document.getElementById("pn").style.height=h+"px";
}
else{
return;
}
setTimeout("addh()",30);
}
function addh() {
if(h<300) {
h+=5;
document.getElementById("pn").style.height=h+"px";
}
else{
return;
}
setTimeout("addh()",30);
}
2016-02-17
后來我復(fù)制別人的筆記,我才發(fā)現(xiàn)原來是不用$(document).ready這部分不要就可以了。
<a href="#"></a>中的 href="javascript:;";就可以了。
2016-01-23