First Ajax Example

添加评论 4 views 2009年6月22日

hello.html页面:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>First Ajax Program</title>
<link rel="stylesheet" type="text/css" href="css/hello.css" />
		<script type="text/javascript " src="js/hello.js">
		</script>
	</meta></head>
	<body onload=init()>
<div id="hello">
			My first ajax program
		</div>
<div id="empty"></div>
 
	</body>
</html>

hello.js文件:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
function init(){
	var hello = document.getElementById("hello");
	var empty = document.getElementById("empty");
 
	hello.className = "declared";
	empty.innerHTML = "Programmed ajax string";
	empty.className = "programmed";
	empty.style.border = "solid green 2px";
	empty.style.width = "200px";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@CHARSET "UTF-8";
.programmed {
	color: red;
	font-family: system;
	font-style: bold;
	font-size: 24px
}
 
.declared {
	color: blue;
	font-family: arial;
	font-style: normal;
	font-size: 36px
}

效果图:
sendpix0

  1. 还没有评论.想坐沙发?
  1. 还没有 trackbacks
订阅评论