<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Shopping list</title>
<style type="text/css">
p { /* 对所有p进行说明 */
color: yellow;
font-family: "arial", sans-serif;
font-size: 1.2em;
}
body {
color: white; /* 没有专门说明的话,body的所有文字都是白色 */
background-color: black; /* 全屏黑色背景 */
}
#purchases { /* 对某一个id进行说明 */
border: 1px solid white; /* 定制边框 */
background-color: #333;
color: #ccc;
padding: 1em;
}
#purchases li { /* 对某一个id的下属进行说明 */
font-weight: bold;
}
</style>
</head>
<body>
<h1>What to buy</h1>
<h1>What to buy</h1>
<p title1="a gentle reminder">Don't forget to buy this stuff.</p>
<p>This is just a test</p>
<ul id="purchases">
<li>A tin of beans</li>
<li>Cheese</li>
<li>Milk</li>
</ul>
<script type="text/JavaScript">
var paras = document.getElementsByTagName("p");
for (var i=0; i< paras.length; i++) {
var title_text = paras[i].getAttribute("title1");
if (title_text != null) {
alert(title_text);
}
}
</script>
</body>
</html>
JS和CSS的初步入门(JS可以取得所有p的内容并显示)
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Proj4.js使用初步入门
一、基础知识 在正式使用Proj4.js时,我们首先需要了解下有关各种
偏移量 json数据 安装方法 -
Wireshark初步入门
在成功地在系统中装好了Wireshark之后,你就可以开始学习使用它了。当你终于打开了这个功能强大的数据包嗅探器时,会发现你什么都看不见!好吧,Wireshark在刚
Wireshark 网络技术 下拉菜单 数据 配置文件 -
yum初步入门
yum的基本使用方法
服务器 配置文件 python -
使用VSCode开发Electron的初步入门
1、创建项目文件夹 如我在E盘中创建了
Electron VSCode gulp 项目文件 html -
01.Enchart初步入门
数据可视化:1.数据可视化主要目的:借助于图形化手段,清晰地
echarts javascript css 数据可视化 数据