找不到錯(cuò)誤呀,求幫忙
?<form>
? <!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
? ? <input type="button" onClick="chang1()" value="改變顏色" > ?
? ? <input type="button" onClick="chang2()" value="改變寬高" >
? ? <input type="button" onClick="chang3()" value="隱藏內(nèi)容" >
? ? <input type="button" onClick="chang4()" value="顯示內(nèi)容" >
? ? <input type="button" onClick="chang5()" value="取消設(shè)置" >
? </form>
? <script type="text/javascript">
? var mystr=document.getElementById("txt");
//定義"改變顏色"的函數(shù)
? function chang1(){
? ? ? mystr.style.color="red";
? ? ? mystr.style.backgroundColor="green";
? }
//定義"改變寬高"的函數(shù)
? function chang2(){
? ? ? mystr.style.wedth="100px";
? ? ? mystr.style.height="400px";
? }
//定義"隱藏內(nèi)容"的函數(shù)
? ?function chang3(){
? ? ? ?mystr.style.display="none";
? ?}
//定義"顯示內(nèi)容"的函數(shù)
? ?function chang4(){
? ? ? ?mystr.style.display="block";
? ?}
//定義"取消設(shè)置"的函數(shù)
? ?function chang5(){
? ? ? ?var mymassage=confirm("是否取消設(shè)置?");
? ? ? ?if(mymassage==true)
? ? ? ?{
? ? ? ? ? ? ?txt.removeAttribute("style");
? ?}
? </script>
2015-07-19
2015-07-19
找不到錯(cuò)誤瞎試的,mystr.removeAttribute("style")這個(gè)我也試過了,也不對(duì)。。。。。