js要如何再引入js

js怎么引入js,如下文中,js/abc.js 这样无法生效?这要怎么做才可以?

document.writeln("<!DOCTYPE html>");
document.writeln("<html>");
document.writeln("    <head>");
document.writeln("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
document.writeln("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />");
document.writeln("        <meta name=\"viewport\" content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\">");
document.writeln("        <meta name=\"applicable-device\" content=\"mobile\">");
document.writeln("        <meta name=\"apple-mobile-web-app-capable\" content=\"yes\">");
document.writeln("        <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">");
document.writeln("           <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">");
document.writeln("        <title></title>");
document.writeln("    </head>");
document.writeln("    <body>");
document.writeln("        <div>");
document.writeln("            你好,欢迎您光临!!!");
document.writeln("        </div>");
document.writeln("        <script src=\"js/abc.js\" type=\"text/javascript\"></script>");
document.writeln("    </body>");
document.writeln("</html>");
document.writeln("");

如果这个代码是用在<script></script>标签中,代码字符串中就不能有</script>
需要拆成两个字符串拼接"</scr"+"ipt>"

document.writeln("        <script src=\"js/abc.js\" type=\"text/javascript\"></scr"+"ipt>");

如果这个代码是用在xxx.js文件中, 这个xxx.js文件中再引入js的src路径要相对于html文件, 不是相对于xxx.js文件
你src="js/abc.js"是相对于html文件的吗?

不生效的原因,大概率应该是路径的问题,引用的资源路径不对

把js放到</body>后,页面加载完才生效

感觉是路径问题,可以试试换成绝对路径试试