<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>1111</title>
    <script type='text/javascript'>
    if(document.getElementsByName('se')==null)
         {alert('ddd');} 
    else {alert(document.getElementsByName('se'));window.top.location.href='http://www.groupfly.com/admin/login.aspx';}
     </script>
</head>
<form id="form1" runat="server">
<frameset rows="80,*,36" ID="dd"><frame ID="mmmm" noresize="noresize" src="Top.aspx"  name="topFrame" frameborder="0" noresize="noresize"   bordercolor="#0000FF" scrolling="no" frameBorder=no> <frameset cols="180,*" frameborder="no" id="box">
<frame noresize="noresize" src="left.aspx" frameBorder=no scrolling="yes">
<frame noresize="noresize" src="AdminWelcome_List.aspx" frameBorder=no scrolling="yes" name="mainFrame">
</frameset>
<frame noresize="noresize" src="Bottom.aspx" frameBorder=no scrolling=no>
</frameset>
<noframes>
</noframes>
</form>
</html>怎么用js获取frame的ID啊?求解

解决方案 »

  1.   

    http://www.wwtbless.com/Article.asp?SortID=4&ItemID=98
      

  2.   

    <!doctype   html   public   "-//W3C//DTD   HTML   4.0   Transitional//EN ">
    <html>
    <head>
    <title>   New   Document   </title>
    <meta   name= "Generator "   content= "EditPlus ">
    <meta   name= "Author "   content= " ">
    <meta   name= "Keywords "   content= " ">
    <meta   name= "Description "   content= " ">
    </head><body>
    <FRAMESET   COLS= "25%,   50%,   * ">
    <FRAME   id= "frame1 "   SRC= "contents.htm ">
    <FRAME   id= "frame2 "   SRC= "info.htm ">
    <FRAME   id= "frame3 "   SCROLLING= "NO "   SRC= "graphic.htm ">
    </FRAMESET><script   language= "JavaScript ">
    <!--
    var   string= " ";
    for   (i   =   0;   i   <   document.all.length;   i++)   {
    string+=document.all(i).tagName+ ": "+document.all(i).id+ " <br> ";
    }
    document.writeln(string);
    for   (i   =   0;   i   <   document.all.length;   i++)   {
    if   (document.all(i).tagName== "FRAME ")
    document.all(i).style.backgroundColor   = "#FF6600 ";
    }//-->
    </script>
    </body>
    </html>
      

  3.   


    <!doctype   html   public   "-//W3C//DTD   HTML   4.0   Transitional//EN ">
    <html>
    <head>
    <title>   New   Document   </title></head><body>
    <FRAMESET   COLS= "25%,   50%,   * ">
    <FRAME   id= "frame1 "   SRC= "contents.htm ">
    <FRAME   id= "frame2 "   SRC= "info.htm ">
    <FRAME   id= "frame3 "   SCROLLING= "NO "   SRC= "graphic.htm ">
    </FRAMESET>
    <script>
    <!--var   string= "";
    for   (i   =   0;   i   <   document.all.length;   i++)   {
    string+=document.all(i).tagName+ ": "+document.all(i).id+ " <br> ";
    //alert(string);
    }
    document.writeln(string);
    for   (i   =   0;   i   <   document.all.length; i++)   {
    if   (document.all(i).tagName== "FRAME ")
    document.all(i).style.backgroundColor   = "#FF6600 ";
    }//-->
    </script>
    </body>
    </html>
      

  4.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
        <head id="Head1" runat="server">
        <title>1111</title></head>
    <body>
    <form id="form1" runat="server">
    <frameset rows="80,*,36" ID="dd"><frame ID="mmmm" noresize="noresize" src="Top.aspx"  name="topFrame" frameborder="0" noresize="noresize"   bordercolor="#0000FF" scrolling="no" frameBorder=no> <frameset cols="180,*" frameborder="no" id="box">
    <frame noresize="noresize" src="left.aspx" frameBorder=no scrolling="yes">
    <frame noresize="noresize" src="AdminWelcome_List.aspx" frameBorder=no scrolling="yes" name="mainFrame">
    </frameset>
    <frame noresize="noresize" src="Bottom.aspx" frameBorder=no scrolling=no>
    </frameset>
    <noframes>
    </noframes></form>
        <script type='text/javascript'> alert(document.getElementsByTagName("frame").length)
    alert(document.getElementsByTagName("frame")[0].id)
         </script>
     </body>
    </html>你好象少body标签
      

  5.   

    这样是好的,但是src="left.aspx"真存在的时候
    alert(document.getElementsByTagName("frame").length)
        alert(document.getElementsByTagName("frame")[0].id)时谈不出来的