main.html 中有N个iframe,都用ID标识了.每个iframe加载的界面可能相同,可能不相同.
a.html  普通的界面.
我怎么在a.html中,获取到当前界面(a.html)在main.html的哪个iframe中呢?

解决方案 »

  1.   

    a.html是其中的一个iframe加载的页面吗?
      

  2.   

    a.html 是从main.html中的某一个iframe加载进去的.
      

  3.   

    在相应iframe的页面中使用window.name 可以得到该iframe的名字从而定位到该iframe
    试试这种方法
      

  4.   

    你直接 在iframe中 传入id不就好了吗?比如
    <iframe src="a.html?id=abc" id="abc"></iframe>
    a.html中
    var location=window.location.href;
    url = location.split("?");
    id = url[1].replace("id=");
    这样就可以获取到id了。这个好像比较饶,不知道可以从dom中能直接获取不,这个得要在网上查一下。或者直接把a.htm改成a.php或者a.asp之类的
    然后直接在a里面用request就好了。