var id = document.getElementById("txt");
//定义"改变颜色"的函数
function a(){
id.style.color="red";
id.style.backgroundColor="#333";
}
//定义"改变宽高"的函数
function b(){
id.style.width="100px";
id.style.height="100px";
}
//定义"改变颜色"的函数
function a(){
id.style.color="red";
id.style.backgroundColor="#333";
}
//定义"改变宽高"的函数
function b(){
id.style.width="100px";
id.style.height="100px";
}
window.open("http://www.imooc.com/","_blank","width=600,height=400,top=100,left=0");
2016-03-08
跟页面初始化有关的js代码必须放在<head>里面,浏览器解释html是按先后顺序的,初始化要求提前进行。如果是通过事件调用执行的function,则对位置无要求。
2016-03-08
已采纳回答 / Lionis
布尔值,是一种类型。它的值有两个 true 和 false,且区分大小写。也就是说,True 和 False 都不是 Boolean类型例子:<...code...>在 Javascript 中所有类型的值都有雨这两个 Boolean 值等价的值。<...code...>例子:<...code...>
2016-03-08
<script type="text/javascript">
function contxt()
{
alert("哈哈,调用函数了!");
}
</script>
</head>
<body>
<form>
<input type="button" value="请点击我" onclick="contxt()" />
</form>
</body>
</html>
function contxt()
{
alert("哈哈,调用函数了!");
}
</script>
</head>
<body>
<form>
<input type="button" value="请点击我" onclick="contxt()" />
</form>
</body>
</html>
2016-03-08
var score=prompt("点击我,对成绩做评价"); //score变量,用来存储用户输入的成绩值。
score = 10 ;
这样就可以了
score = 10 ;
这样就可以了
2016-03-08
<script type="text/javascript">
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display="block";
}
</script>
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display="block";
}
</script>
2016-03-08