最后取消按鈕沒用,彈出窗口 點(diǎn)確定,沒反應(yīng)
?<script type="text/javascript">
? var p=document.getElementById("txt");
//定義"改變顏色"的函數(shù)
function color(){
? ?p.style.color="red";
? ?p.style.backgroundColor="green";}
//定義"改變寬高"的函數(shù)
function wh(){
? ? p.style.width="300px";
? ? p.style.height="200px";}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
? ?p.style.display="none";}
//定義"顯示內(nèi)容"的函數(shù)
function block(){
?p.style.display="block";}
//定義"取消設(shè)置"的函數(shù)
function cancel(){
var cl=confirm("是否取消設(shè)置?");
?if (cl==true)
?{p.removeAttribute("style");}
}
? </script>
</body>
</html>
2016-03-27
帥哥你沒有獲取 對象 那個p 你最起碼document.getElementById 或者tag選擇你要操作的bom標(biāo)簽吧
2016-03-27
?<script type="text/javascript">
? var p=document.getElementById("txt");
//定義"改變顏色"的函數(shù)
function color(){
? ?p.style.color="red";
? ?p.style.backgroundColor="green";}
//定義"改變寬高"的函數(shù)
function wh(){
? ? p.style.width="300px";
? ? p.style.height="200px";}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
? ?p.style.display="none";}
//定義"顯示內(nèi)容"的函數(shù)
function block(){
?p.style.display="block";}
//定義"取消設(shè)置"的函數(shù)
function cancel(){
var cl=confirm("是否取消設(shè)置?");
?if (cl==true)
?{p.removeAttribute("style");}
}
? </script>
</body>
</html>
2016-03-27
你點(diǎn)下前面的樣式,之后再重置下試試。
2016-03-27
//定義"取消設(shè)置"的函數(shù)
var mychar=document.getElementById('text');
var a=confirm("是否取消設(shè)置?");
?if (a==true)
?{mychar.removeAttribute("style");}
}
看這里