什么是嵌入式JavaScript? [英] What is inline javascript?

查看:319
本文介绍了什么是嵌入式JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 我说inline javascript意味着javascript

  2. 我的程序员意味着inline javascript是1行的javascript,并且像< button onclick =alert('test')>


我给他的权利,内嵌JavaScript也是onclick ='alert(...)因为它再次像我solutin#1,所有JavaScript加载HTML而不是JS。



谁是对的?



我们有一个HTML文件,并且有< script> ....< / script> javascript在底部,也就是内嵌javascript,对吗?

解决方案

不带 src 的脚本标签(即直接在HTML文档)被称为内联脚本。



一个 onclick =... attrib ute被称为内联事件处理程序。


Me and my programmer has 2 different views for what "Inline JavaScript" is.

  1. I said inline javascript means javascript placed directly in the HTML file, without in a .JS file.

  2. My programmer means inline javascript is javascript on 1 line, and like <button onclick="alert('test')">

I give him right in, that inline javascript also is "onclick='alert(...)" because it again is like my solutin #1, all javascript loaded in HTML and not in JS.

Who's right?

We have a HTML file, and there is <script>....</script> javascript in the bottom, that is inline javascript, right?

解决方案

A script tag without a src (ie. with code directly in the HTML document) is referred to as an inline script.

An onclick="..." attribute is called an inline event handler.

这篇关于什么是嵌入式JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆