<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<a id="a1" href="https://www.baidu.com" onmouseover="bigger()" onmouseout="smaller()" >百度一下, 你就知道!</a >
</body>
<script> var a = document.getElementById("a1"); function bigger() { a.style.fontSize = "300%"; a.style.color = "red"; } function smaller() { a.style.fontSize = "100%"; a.style.color = "blue"; } </script>
</html>
复制代码
直接将脚本嵌入到 HTML 标记的事件中javascript
使用
<script>
标记将脚本嵌入到网页中html
咱们这个特效, 用的就是
嵌入式
java
经过
<script>
标记的src
属性连接外部脚本文件正则表达式
势力范围