且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HTML脚本标签-使用src时可以添加脚本

更新时间:2023-02-07 13:32:27

不行.

使用最下面的一个.

答案很长……

w3c状态

"SCRIPT元素将脚本放置在文档中.该元素可以在HTML文档的HEAD或BODY中出现任意次数.

"The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document.

脚本可以在SCRIPT元素的内容内或外部文件中定义.如果未设置src属性,则用户代理必须将元素的内容解释为脚本.如果src具有URI值,则用户代理必须忽略元素的内容,并通过URI检索脚本."

The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI."

来源: http://www.w3.org/TR/html401/interact/scripts.html