![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/2937dccfa83bc8443d038d73f5186c76.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<p>我是一段文字</p>
<p>我是一段文字</p>
<p>我是一段文字</p>
<p>我是一段文字</p>
<button onclick="bered()">点我变红</button>
<script>
function bered() {
var pArray =document.getElementsByTagName('p');
for (var i = 0; i <pArray.length ; i++) {
pArray[i].style.cssText='border:1px solid red;font-size:15px;';
}
}
</script>
</div>
</body>
</html>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/1ea2ffd4ad4d9d673078f99b97461704.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
var people ={
name:'xiaoming',
sex:'男',
age:20,
say:function () {
alert('我是软件工程师' + '来自上海');
}
}
//alert(people.name),
people.say();
</script>
</head>
<body>
</body>
</html>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e08fafa0cb538434885421bd4eaed58b.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
for(var i=2;i<100;i++){
var sum=0;
for(var j=1;j<=i;j++){
if(i%j==0){
sum++;
}
}if(sum==2){
document.write(i+',');
}
}
</script>
</head>
<body>
</body>
</html>