step 1.
new a html file
<html>
<head>
<link type="text/css" href="example.css" rel="stylesheet" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<script language="javascript" type="text/javascript" src="example.js"></script>
<div>your dom elements</div>
</html>
step 2.
new a js file name example.js. following is the simple code
var mydom = "here am i";
document.writ(mydom);
//padding-right:18px; is so useful
本文介绍了如何从零开始创建一个简单的HTML文件,并通过引入外部JavaScript文件实现基本的DOM操作。文章提供了完整的代码示例,包括HTML结构设置、CSS样式链接、JavaScript文件的引用及简单代码实现。
1179

被折叠的 条评论
为什么被折叠?



