Blogger Information
Blog 9
fans 0
comment 0
visits 14512
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
script标签的src属性
小张的博客
Original
1945 people have browsed it

src属性指定外部文件路径,浏览器根据src属性值请求外部文件然后将外部文件的内容插入script标签之间,结果会覆盖原本script标签之间的内容,类似于document.write()会覆盖原本的dom一样。导致在编辑时写入的js代码不会被执行。
文件并非必须是js文件,任意类型的文本文件都可以,比如html,css,xml,txt。要求是这些文件里面的内容是js代码即可。
文件:”5.txt”
文件内容:console.log(“5.txt”);

  1. var a = 20;
  2. <?php
  3. $b = 30;
  4. echo "console.log(a),$b"
  5. ?>

对于php文件,服务器只会解析<?php….?>之间的代码,除此之外的代码会被当做纯字符串原样返回给浏览器。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post