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