設(shè)置寬高無效,請大家?guī)兔匆幌?/h1>
var txt = document.getElementById("txt");
??? //定義"改變顏色"的函數(shù)
??? function color(){
??????? txt.style.color="red";
??????? txt.style.backgroundColor="#ccc";
??? }
??? //定義"改變寬高"的函數(shù)
??? function size(){
??????? txt.style.width="400px";
??????? txt.style.height="300px"
??? }
??? //定義"隱藏內(nèi)容"的函數(shù)
??? function hide(){
??????? txt.style.display="none";
??? }
??? //定義"顯示內(nèi)容"的函數(shù)
??? function show(){
??????? txt.style.display="block";
??? }
??? //定義"取消設(shè)置"的函數(shù)
??? function resetText(){
??????? var reset = confirm("是否取消設(shè)置");
??????? if( reset ==true ){
??????????? txt.removeAttribute("style");
??????? }
??? }
var txt = document.getElementById("txt");
??? //定義"改變顏色"的函數(shù)
??? function color(){
??????? txt.style.color="red";
??????? txt.style.backgroundColor="#ccc";
??? }
??? //定義"改變寬高"的函數(shù)
??? function size(){
??????? txt.style.width="400px";
??????? txt.style.height="300px"
??? }
??? //定義"隱藏內(nèi)容"的函數(shù)
??? function hide(){
??????? txt.style.display="none";
??? }
??? //定義"顯示內(nèi)容"的函數(shù)
??? function show(){
??????? txt.style.display="block";
??? }
??? //定義"取消設(shè)置"的函數(shù)
??? function resetText(){
??????? var reset = confirm("是否取消設(shè)置");
??????? if( reset ==true ){
??????????? txt.removeAttribute("style");
??????? }
??? }
2017-04-12
函數(shù)名出了問題,size改成別的就可以了