<script type="text/javascript">
document.write("开启JS之旅!");
</script>
document.write("开启JS之旅!");
</script>
2016-03-15
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>热身</title>
</head>
<body>
<p id="p1">我是第一段文字</p>
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
document.write('hello');
document.getElementById('p1').style.color = 'red';
</script>
<title>热身</title>
</head>
<body>
<p id="p1">我是第一段文字</p>
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
document.write('hello');
document.getElementById('p1').style.color = 'red';
</script>
2016-03-15
function Block()
{
var mychar = document.getElementById("txt");
mychar.style.display = "block";
}
//定义"取消设置"的函数
function Cancel(){
var mychar=confirm("确定取消设置吗?")
if(mychar==true)
{
var obj=document.getElementById("con");
obj.removeAttribute("style");
}
}
{
var mychar = document.getElementById("txt");
mychar.style.display = "block";
}
//定义"取消设置"的函数
function Cancel(){
var mychar=confirm("确定取消设置吗?")
if(mychar==true)
{
var obj=document.getElementById("con");
obj.removeAttribute("style");
}
}
已采纳回答 / qq_卍卐_1
<!DOCTYPE html><html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function circle(){ const pi = 3.14...
2016-03-15
已采纳回答 / qq_绿树苍天
function checkscope(){}<input type="button" value="调用checkscope" onclick="checkscope()"/>
2016-03-15
已采纳回答 / qq_冲哥_0
HTML代码从上往下解析,你放在head里面,就先解析var mychar=document.getElementById("con"),但这时并没有id=con对应的元素,因为id=con的元素在var mychar=document.getElementById("con")这句话的后面,所以就没效果,这是要用window.onload,它表示当所有元素都加载完之后执行, 放在head里面没有问题。window.onload=function(){var mychar=document.getElem...
2016-03-15
mychar.style.color="red";
mychar.style.background="#CCC";
mychar.style.width="300px";
一样的效果,但是提示要用.backgroundColor
mychar.style.background="#CCC";
mychar.style.width="300px";
一样的效果,但是提示要用.backgroundColor
2016-03-15
已采纳回答 / 荷犸
哈哈,因为这里的代码效果是实时显示的啊,它里面有一个window.open(‘http://www.imooc.com/’)语句,然后你每次输入代码,它就同步显示然后不停触发这条语句,所以会不停弹出首页呢。你输入了 mywin.close();这条语句就不会出现这个问题啦
2016-03-15
最新回答 / 左边_右边
var b=confirm("取消设置?"); if(b==true){ a.removeAttribute("style") }或者直接归位 if(b==true){ a.style.color="#000";a.style.backgroundColor="#fff";a.style.width="600px"; a.style.height="400px"; a.style.display="block" }
2016-03-15