js url处理的问题 var url = "../aa/aa.html" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对了,补充下, //这样定义是可以实现的 var url="../aa/aa.html"; //我原意是获取当前url(有虚拟目录就取虚拟目录,无的话就得到原url) //如:http://127.0.0.1/aaa.html===>在这个页就得到http://127.0.0.1,若有虚拟目录:http://127.0.0.1/web/xxx.html,即得到http://127.0.0.1/web/ .net开发时候 可以用统一的函数来写路径例如:我们有个论坛地址www.bbs.ishangdu.comfunction string bbsUrl(){//处理返回地址}js调用这个函数var url=<%= bbsUrl%>你可以把bbsUrl写成全局的函数统一调用 没理解你到底要什么效果,是不是要得到当前文件所在的目录呢?<script>var url = document.location.href.substring(0,document.location.href.indexOf(window.document.location.pathname)) + document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1);alert(url);</script> 为什么不设置target="_blank"也能在新窗口打开连接? !!请问这是什么编码,怎么应用,立即给分 彈出窗口怎樣刷新父窗口的iframe? 如何用javascipt获得上一页面的绝对路径?用?号传过来的! getElementById的作用 一些JS入门级问题,请帮忙!谢谢 请问各位老大 层的相对打开?高手进! emu(ston) goldenlove(潇洒.net)看过来 想在表格中使文本具有滚动条,如何做? javascript处理大量数据导致IE未响应 100 分求助 iframe src
var url="../aa/aa.html";
//我原意是获取当前url(有虚拟目录就取虚拟目录,无的话就得到原url)
//如:http://127.0.0.1/aaa.html===>在这个页就得到http://127.0.0.1,若有虚拟目录:http://127.0.0.1/web/xxx.html,即得到http://127.0.0.1/web/
例如:我们有个论坛地址www.bbs.ishangdu.com
function string bbsUrl()
{
//处理返回地址
}
js调用这个函数
var url=<%= bbsUrl%>
你可以把bbsUrl写成全局的函数
统一调用
<script>
var url = document.location.href.substring(0,document.location.href.indexOf(window.document.location.pathname)) + document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1);alert(url);
</script>