Javascript Basi...LOGIN

Javascript Basics Tutorial: DOM and CSS

How to use DOM to change the style of html

The following code:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>DOM 与 CSS</title>	
</head>
<body>
	<div name="dv" id="dv" width="300" height="200">php 中文网</div>

	<script type="text/javascript">
		var dv = document.getElementById("dv").style.color = "red";
	</script>
</body>
</html>


Next Section
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>DOM 与 CSS</title> </head> <body> <div name="dv" id="dv" width="300" height="200">php 中文网</div> <script type="text/javascript"> var dv = document.getElementById("dv").style.color = "red"; </script> </body> </html>
submitReset Code
ChapterCourseware