我使用iframe框架做管理系统,不同的菜单存放在不同目录下,我想让菜单自动高亮显示,我通过如下js能够获得当前菜单所在文档目录,可是怎么在PHP里边调用js里获得的值作为判断依据,js代码贴到下面请高手帮忙: <script>
function getMainFrameURL()
{ var url = parent.MainFrame.location.href;
pic1=url.substring(url.indexOf("http://localhost:88/Point/")+26);
pic2=pic1.substring(0,pic1.lastIndexOf("/"));
if(pic2!=null);
alert(pic2); }
</script>
function getMainFrameURL()
{ var url = parent.MainFrame.location.href;
pic1=url.substring(url.indexOf("http://localhost:88/Point/")+26);
pic2=pic1.substring(0,pic1.lastIndexOf("/"));
if(pic2!=null);
alert(pic2); }
</script>
if($pic2 == "customers")
{
echo "<li class=\"current\">";
}
else
{
echo "<li>";
}
Js 是客户端 PHP是服务器端 无法直接传值。 PHP 可以传值给JS
找一下ajax的封装类 然后看看例子怎么调用,如果有php的基础 略懂一些JS就能胜任了。这个ajax的封装类网上很多。另外Jquery 更容易一些,,没js基础你得重头开始看 如何使用