Home > Web Front-end > JS Tutorial > JavaScript HTML CSS external links

JavaScript HTML CSS external links

高洛峰
Release: 2016-10-31 14:36:37
Original
1902 people have browsed it

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>
Copy after login

CSS文件

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template