隱藏和顯示沒有效果,有人能幫我看一下錯(cuò)誤在哪兒?jiǎn)幔?/h1>
<!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
????<input?type="button"?value="改變顏色"?onclick="changeColor()">??
????<input?type="button"?value="改變寬高"?onclick="changeS()">
????<input?type="button"?value="隱藏內(nèi)容"?onchick="hide()">
????<input?type="button"?value="顯示內(nèi)容"?onclick="show()">
????<input?type="button"?value="取消設(shè)置"?onclick="clearN()">
??</form>
??<script?type="text/javascript">
??var?d=document.getElementById("txt");
//定義"隱藏內(nèi)容"的函數(shù)
function?hide(){
????d.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function?show(){
????d.style.display="block";
}
<!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件--> ????<input?type="button"?value="改變顏色"?onclick="changeColor()">?? ????<input?type="button"?value="改變寬高"?onclick="changeS()"> ????<input?type="button"?value="隱藏內(nèi)容"?onchick="hide()"> ????<input?type="button"?value="顯示內(nèi)容"?onclick="show()"> ????<input?type="button"?value="取消設(shè)置"?onclick="clearN()"> ??</form> ??<script?type="text/javascript"> ??var?d=document.getElementById("txt"); //定義"隱藏內(nèi)容"的函數(shù) function?hide(){ ????d.style.display="none"; } //定義"顯示內(nèi)容"的函數(shù) function?show(){ ????d.style.display="block"; }
2016-11-15
onclick寫錯(cuò)了 你寫成onchick了