游览器中的JavaScript
<html>
<!--声明式:不能显示-->
<head>
<!--设置网页编码-->
<meta charset="utf-8"/>
<title> 我的标题 html</title>
</head>
<!--能够显示的内容-->
<body>
<script>
function print(s){
document.write(s);
}
function println(s){
print(s+"</br>");
}
if(confirm("还要继续吗?")){
alert("好,继续");
}else{
alert("好吧,再见");
}
var name=prompt("你的名字是:");
alert(name);
</script>
<p onmouseover="alert('hi')">
一个段落
</p>
</body>
</html>
1 <html> 2 <!--声明式:不能显示--> 3 <head> 4 <!--设置网页编码--> 5 <meta charset="utf-8"/> 6 <title> 我的标题 html</title> 7 <script> 8 var count=10; 9 function update(){ 10 if(count>=10){ 11 status=count--; 12 } 13 } 14 function guanbi(){ 15 w.close(); 16 } 17 function jump(){ 18 location="http://www.baidu.com"; 19 } 20 </script> 21 </head> 22 <!--能够显示的内容--> 23 <body onLoad="setInterval('jump()',1000);"> 24 <script> 25 var w=open("hello.html","big","width=400,height=300"); 26 w.moveTo(50,40); 27 </script> 28 <p > 29 </p> 30 </body> 31 </html>
<html>
<!--声明式:不能显示-->
<head>
<!--设置网页编码-->
<meta charset="utf-8"/>
<title> 我的标题 html</title>
</head>
<!--能够显示的内容-->
<body>
<img name="aa" src="a.jpg">
<script>
function print(s){
document.write(s);
}
function println(s){
print(s+"</br>");
}
alert(document.aa.src);
for(x in document){
println(x);
}
</script>
</body>
</html>
道阻且长,行则将至

浙公网安备 33010602011771号