Script tags with src and code between script tags

前端 未结 4 1772
执念已碎
执念已碎 2020-12-06 19:16

Is the following valid javascript? Would the variable be available to the externally called script?



        
4条回答
  •  天涯浪人
    2020-12-06 19:28

    Read this, http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1

    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. Note that the charset attribute refers to the character encoding of the script designated by the src attribute; it does not concern the content of the SCRIPT element.

提交回复
热议问题