javascript的使用方法有哪三种
时间:2022-02-11 17:16
方法:1、在标签的事件属性内使用,语法“<标签名 事件属性名=“js代码”>”;2、写在script标签对中,语法“<script>js代码</script>”;3、使用“<script src="js代码文件"></script>”语句。 本教程操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。 js的使用方式和css类似: 1.行内式 在标签属性内使用 ""; 2.内嵌式 直接使用script标签 3.链入式 使用<script type=“text/javascript”src=“js文件路径”>引入外部.js文件 js文件代码 【推荐学习:javascript高级教程】 以上就是javascript的使用方法有哪三种的详细内容,更多请关注gxlsystem.com其它相关文章!<body onload="alert('hello world3')";>
</body>
<script>
alert("hello world2");
</script>
<script type="text/javascript" src="js学习.js"></script>
alert("hello world 1");