JavaScript 关于根目录调用

JavaScript 关于根目录调用,第1张

JSP引用JS文件的路径有以下三种:

1、使用相对于jsp页面的相对路径

<script type="text/javascript" src="/ajs"></script>

2、使用相对于Web工程的相对路径

<script type="text/javascript" src="scripts/ajs"></script>

PS:使用此方法这种方式引用,如果直接访问该jsp页面>

nodejs中的os模块中可以获取当前用户的home目录,获取 *** 作系统的主机名,以及获取网络地址的网络接口。下面利用几个实例说明os模块获取这些信息, *** 作如下:

1、获取当前用户的home的目录路径,利用oshomedir();如下图所示

2、获取 *** 作系统的主机名称,利用oshostname();如下图所示:

3、获取返回一个数组,包含平均负载,利用osloadavg();如下图所示:

4、获取网络地址的网络接口,返回一个对象,利用osnetworkInterfaces();如下图所示:

5、获取Nodejs编译时的 *** 作系统平台,利用osplatform();如下图所示:

6、获取指定 *** 作系统的发行版,利用osrelease();如下图所示:

<script type="text/javascript">

thisURL = documentURL;

thisHREF = documentlocationhref;

thisSLoc = selflocationhref;

thisDLoc = documentlocation;

strwrite = " thisURL: [" + thisURL + "]<br />"

strwrite += " thisHREF: [" + thisHREF + "]<br />"

strwrite += " thisSLoc: [" + thisSLoc + "]<br />"

strwrite += " thisDLoc: [" + thisDLoc + "]<br />"

documentwrite( strwrite );

</script>

<script type="text/javascript">

thisTLoc = toplocationhref;

thisPLoc = parentdocumentlocation;

thisTHost = toplocationhostname;

thisHost = locationhostname;

strwrite = " thisTLoc: [" + thisTLoc + "]<br />"

strwrite += " thisPLoc: [" + thisPLoc + "]<br />"

strwrite += " thisTHost: [" + thisTHost + "]<br />"

strwrite += " thisHost: [" + thisHost + "]<br />"

documentwrite( strwrite );

</script>

<script type="text/javascript">

tmpHPage = thisHREFsplit( "/" );

thisHPage = tmpHPage[ tmpHPagelength-1 ];

tmpUPage = thisURLsplit( "/" );

thisUPage = tmpUPage[ tmpUPagelength-1 ];

strwrite = " thisHPage: [" + thisHPage + "]<br />"

strwrite += " thisUPage: [" + thisUPage + "]<br />"

documentwrite( strwrite );

</script>

以上就是关于JavaScript 关于根目录调用全部的内容,包括:JavaScript 关于根目录调用、javascript 怎么获取外部文件.js中的数组值.js文件内容、js如何得到当前登陆用户的详细信息等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9343210.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-27
下一篇2023-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存