function openWindow(){
var check = confirm("确认打开窗口吗?");
if(check){
var web=prompt("输入网址:","www.imooc.com")
window.open(web,'_ablank','with=400px,height=500px,menubar=no,toolbar=no');
}
else{
window.close();
}
}
var check = confirm("确认打开窗口吗?");
if(check){
var web=prompt("输入网址:","www.imooc.com")
window.open(web,'_ablank','with=400px,height=500px,menubar=no,toolbar=no');
}
else{
window.close();
}
}
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