从Javascript解析相对URL(对于ASP.NET)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Javascript解析相对URL(对于ASP.NET)相关的知识,希望对你有一定的参考价值。
Url = function() { } Url.prototype = { _relativeRoot: '<%= ResolveUrl("~/") %>', resolve: function(relative) { var resolved = relative; if (relative[0] == '~') resolved = this._relativeRoot + relative.substring(2); return resolved; } } $Url = new Url(); //Now, anywhere I need to resolve a relative url in a script, I can do this: var logoUrl = $Url.resolve("~/Images/logo.png");
以上是关于从Javascript解析相对URL(对于ASP.NET)的主要内容,如果未能解决你的问题,请参考以下文章