|
解決方法也很簡(jiǎn)單:
復(fù)制代碼 代碼如下:
script language="Javascript" type="text/Javascript" src='<%=ResolveUrl("~/js/media.js") %>'></script>
<%=ResolveUrl("~/js/media.js") %>'>正是ASP.NET獲取絕對(duì)路徑的輸出方法.
另:
如果路徑問(wèn)題存在于Javascript腳本中
在后臺(tái)已經(jīng)將其內(nèi)容寫(xiě)好:
復(fù)制代碼 代碼如下:
protected void Page_Load(object sender, EventArgs e)
{
string swf = ResolveUrl("~/images/flash_menu20090430.swf");
string menu =ResolveUrl("~/menu.xml");
string list = ResolveUrl("~/list.xml");
this.Literal1.Text = "var swf=/"" + swf + "/";var menu=/"" + menu + "/";var list=/"" + list + "/";";
}
用Literal控件在script腳本中:
復(fù)制代碼 代碼如下:
<script type="text/Javascript"><!--
<ASP:Literal ID="Literal1" runat="server"></ASP:Literal>
var so = new SWFObject(swf, "mymovie", "948", "307", "8", "#ffffff");
so.addVariable("menuurl", ReplaceMystr(menu));
so.addParam("wmode", "opaque");
so.addVariable("listurl", ReplaceMystr(list));
so.write("flashkv");
// --></script>
AspNet技術(shù):ASP.NET 路徑問(wèn)題的解決方法,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。