Home  >  Article  >  Web Front-end  >  JavaScript HTML CSS external links

JavaScript HTML CSS external links

高洛峰
高洛峰Original
2016-10-31 14:36:371825browse

HTML文件

<!--<html>
<head><link rel="stylesheet" type="text/css" href="css/test.css"></head>
<body>
<h1>这是标题 1</h1><h2>这是标题 2</h2><p>这是段落</p><p class="no2">这个段落设置了内边距。</p>
</body></html>
--><!DOCTYPE html><html><body>
<h1>My Web Page</h1>
<p id="demo">A Paragraph.</p>
<button type="button" onclick="myFunction()">点击这里</button>
<p><b>注释:</b>myFunction 保存在名为 "myScript.js" 的外部文件中。</p>
<script type="text/javascript" src="js/myScript.js"></script>
</body></html>

 

CSS文件

h1 {color: red}p {color: blue}
 
JavaScript文件
function myFunction(){document.getElementById("demo").innerHTML="My First JavaScript Function1";}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn