<html>
<head><title></title></head>
<body>
<script>
var loop=3;
//var random=parseInt(Math.random()*10);
var random=4;
alert(typeof(random));
while(loop){
loop--;
var input=prompt("请输入数字0到9");
alert(typeof(input));
if(random==input)
{alert("猜中");break;}
if(!loop){
alert("三次都没猜中,");
break;}
alert("这次没猜中,下次努力");
}
</script>
</body>
</html>
<html>
<head>
<script>
function func(){
alert("这是一个回调函数");
}
</script>
</head>
<body>
<input type=button value="点我" onclick="func()"/>
</body>
</html>
<html>
<head></head>
<body>
<script>
var param=" ";
alert(typeof(param));
for(var i in window){
param+=i+":"+window[i]+"\n";
}
alert(param);
</script>
</body>
</html>
<html>
<head>
<title></title>
<style>
a{
display:block;
width:200px;
border:1px solid #000;
margin-left:50px;
margin-top:10px;
text-align:center;
cursor:pointer;
text-decoration:none;
}
a:hover{
background:lightgray;
}
/*导航条*/
#naviBar{
width:100%;
height:30px;
/*显示下边框*/
border-botton:1px solid #000;
text-align:center;}
#menuList{
width:30%;
height:180px;
float:left;
border-right:1px solid #000;}
#main{
width:69%;
height:180px;
float:left;
}
</style>
</head>
<body>
<div id="navibar">
导航:<span id="path">内容一</span>
</div>
<div id="menuList">
<a href="main.html" target="main">菜单一</a><br><br>
<a href="b.html" target="main">菜单二</a><br><br>
<a href="c.html" target="main">菜单三</a><br><br>
<a href="d.html" target="main">菜单四</a><br><br>
</div>
<div id="main">
<iframe name="main" frameborder="2" src="" width="100%" height="100%"></iframe>
</div>
<script>
function callback(){
var path=document.getElementById("path");
path.innerHTML+=2;
}
var links=document.getElementsByTagName("a");
for(var i=0;i<links.length;i++)
{links[i].onclick=callback;}
</script>
</body>
</html>
<html>
<head>
<title></title>
<style>
#main{
width:370px;
height:150px;
border:1px solid #ccc;
position:absolute;}
</style>
</head>
<body>
<div id="main">
<iframe allowTrasparency="true" scrolling="auto" width="100%" height="122" src="" id="editor" frameBorder="0"></iframe>
</div>
</body>
<script>
var editPane=null;
(function(){
editPane=document.getElementById("editor").contentWindow;
editPane.document.designMode="on";//打开编辑模式
editPane.document.contentEditable=true;
editPane.document.open();//打开文档流
//写入文档信息
editPane.document.write(
"富文本编辑器");
editPane.document.close();
})();
</script>
</html>
<script>
var newwindow=window.open("about:blank","none","width=280,height=160");
newwindow.document.body.innerHTML="<center>这是一个弹出窗口</center>";
</script>