我的寬高設(shè)置怎么不行
<form>
? <!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
? ? <input type="button" onclick="changeColor()" ?value="改變顏色" ?/> ?
? ? <input type="button" onclick="height()" value="改變寬高" />
? ? <input type="button" onclick="hide()" ?value="隱藏內(nèi)容" />
? ? <input type="button" onclick="cover()" value="顯示內(nèi)容" ?/>
? ? <input type="button" onclick="del()" value="取消設(shè)置" ?/>
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
? function changeColor()
? {
? ? ? document.getElementById("con").style.color="red";
? }
//定義"改變寬高"的函數(shù)
function height()
{
? ? ? document.getElementById("txt").style.height="200px";
? ? ? document.getElementById("txt").style.width="300px";
? }
//定義"隱藏內(nèi)容"的函數(shù)
function hide()
{
? ? ? var hid=document.getElementById("con");
? ? ? hid.style.display="none";
? }
//定義"顯示內(nèi)容"的函數(shù)
function cover()
{
? ? ? var cov=document.getElementById("con");
? ? ? cov.style.display="block";
? }
//定義"取消設(shè)置"的函數(shù)
function del()
{
? ? ? var cde=confirm("是否取消設(shè)置");
? ? ? if(cde==true)
? ? ? {
? ? ? ? var abc=document.getElementById("con") ;
? ? ? ? abc.removeAttribute("style");
? ? ? }
??}
2017-10-17
代碼沒(méi)問(wèn)題,是不是網(wǎng)頁(yè)卡住了,或者全屏操作一下。
2017-10-15
因?yàn)槟愠?/p>