javascript之高级程序设计

本文将带领您深入了解JavaScript,从基础语法开始,逐步构建互动游戏,掌握如何使用JavaScript实现游戏逻辑、用户交互和动画效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<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>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值