〜/ javascript中相当于 [英] ~/ equivalent in javascript
本文介绍了〜/ javascript中相当于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在做基于路径的根在JavaScript中引用的任何聪明的办法,就是这个样子,我们有〜/
在ASP.NET?
Any smart way of doing a "root" based path referencing in JavaScript, just the way we have ~/
in ASP.NET?
推荐答案
让你的网页生成一个标记的东西,如:
Have your page generate a tag with something like:
<link rel="home" id="ApplicationRoot" href="http://www.example.com/appRoot/" />
然后,有一个JavaScript函数提取值,如:
Then, have a function in JavaScript that extracts the value such as:
function getHome(){
return document.getElementById("ApplicationRoot").href;
}
这篇关于〜/ javascript中相当于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文