<!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>
</head>
<body>
<!--js行内式
直接把代码书写在标签上
a 标签书写在herf上
非a标签书写在行为属性上
-->
<!--内嵌式
把代码书写在script标签对内
-->
<!--外链式把代码书写在js文件内-->
<a href="javascript:alert('hellow world');">点击我一下</a>
<!--alert('hellow world')在浏览器弹出提示框-->
<div onclick="alert('hellow world')">点击我一下</div>
<!--onclick点击行为属性-->
<script>
alert('hellow world')
</script>
</body>
</html>
html.javascript---->书写方式
最新推荐文章于 2024-07-25 22:24:14 发布