函數采用如下實現方式function $(id) {return document.getElementById(id);}function hide(){$(id).style.display='none';}如何實現$("id").hide()方式使用<div id="box"></div>function show(){$(id).style.display='block';}function html(str){$(id).innerHTML=str;}如何實現類似jQuery的使用方式:使用$("box")返回document.getElementById(“box”)對象,使用$("box").show()顯示元素,使用$("box").hide()隱藏元素,使用$("box").html("hello")設置內容,請問該如何實現?
- 2 回答
- 0 關注
- 697 瀏覽
添加回答
舉報
0/150
提交
取消