function a1()
{
var mychar=document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
//定义"改变宽高"的函数
function a2()
{
var mychar=document.getElementById("txt");
mychar.style.height="400px";
mychar.style.width="400px";
}
{
var mychar=document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
//定义"改变宽高"的函数
function a2()
{
var mychar=document.getElementById("txt");
mychar.style.height="400px";
mychar.style.width="400px";
}
<p id="p1">我是第一段文字</p>
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
docunment.write("hello")
docunment.getElementById("p1").style.color="blue";
</script>
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
docunment.write("hello")
docunment.getElementById("p1").style.color="blue";
</script>
2016-03-26
var mychar=doucument.getElementById("con") ;
document.write("结果:"+mychar); //输出获取的P标签。 怎么不对呢,错在哪里了。。
document.write("结果:"+mychar); //输出获取的P标签。 怎么不对呢,错在哪里了。。
2016-03-26
function openWindow(){
var code = confirm("点击打开新窗口")
if (code=true){
window.open("http://www.imooc.com","width=500px,height=600px,menubar=no,toolbar=no")
}
}
var code = confirm("点击打开新窗口")
if (code=true){
window.open("http://www.imooc.com","width=500px,height=600px,menubar=no,toolbar=no")
}
}