<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.focus{
color: #fff;
background-color: red;
}
.fs{
font-size: 80px;
}
</style>
</head>

<body>
<div>
<span class="focus">首页</span>
<span>新闻</span>
<span>图片</span>
<span>热点</span>
</div>
<div id="tip">你好</div>
</body>
</html>
<script>
var spans = document.getElementsByTagName('span');
spans[0].setAttribute('title','这是一个首页')
spans[1].setAttribute('title',spans[0].getAttribute('title'))
spans[0].removeAttribute('title')

var tip = document.getElementById('tip');
tip.className = 'focus fs'
tip.style.color = 'yellow'
tip.style.fontSize = '15px'


</script>