目的是得到这种内容图片的src:<v:rect style="top:50px;left:50px;width:300px;height:202px">
  <v:imagedata src="image001.jpg"/>
</v:rect><v:rect style="top:50px;left:50px;width:300px;height:202px">
  <v:imagedata src="image002.jpg"/>
</v:rect>document.images不行,有其他办法吗?

解决方案 »

  1.   

    本帖最后由 net_lover 于 2010-03-04 12:42:45 编辑
      

  2.   

    <script>
    document.onmouseup=ss;
    function ss(){
        var obj=document.getElementsByTagName("v:imagedata");
        var id=[]
        for(var i=0;i<obj.length;i++)id.push(obj[i].getAttribute("src"));
        alert(id);
    }
    function dd(){
        var obj=document.getElementById("tt");
        obj.value="";
    }
    </script>
    <input type=button value=get onclick="ss()">
    <v:rect style="top:50px;left:50px;width:300px;height:202px"> 
      <v:imagedata src="image001.jpg"/> 
    </v:rect> <v:rect style="top:50px;left:50px;width:300px;height:202px"> 
      <v:imagedata src="image002.jpg"/> 
    </v:rect> 
      

  3.   

       使用正常表达式来获取呢。
    http://blog.sina.com.cn/s/blog_028169d20100d3g5.html
    去这看下嘛
      

  4.   

    [Quote=引用 2 楼 shan1119 的回复:]
    <html 
    xmlns:v="urn:schemas-microsoft-com:vml" 
    xmlns:o="urn:schemas-microsoft-com:office:office" 
    xmlns:w="urn:schemas-microsoft-com:office:word" 
    xmlns:x="urn:schemas-microsoft-com:office:excel" 
    xmlns:p="urn:schemas-microsoft-com:office:powerpoint" 
    xmlns:a="urn:schemas-microsoft-com:office:access" 
    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 
    xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" 
    xmlns:rs="urn:schemas-microsoft-com:rowset" 
    xmlns:z="#RowsetSchema" 
    xmlns:b="urn:schemas-microsoft-com:office:publisher" 
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
    xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" 
    xmlns:odc="urn:schemas-microsoft-com:office:odc" 
    xmlns:oa="urn:schemas-microsoft-com:office:activation" 
    xmlns:html="http://www.w3.org/TR/REC-html40" 
    xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:rtc="http://microsoft.com/officenet/conferencing" 
    xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" 
    xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" 
    xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" 
    xmlns:ppda="http://www.passport.com/NameSpace.xsd" 
    xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" 
    xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" 
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
    xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" 
    xmlns:udc="http://schemas.microsoft.com/data/udc" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" 
    xmlns:ec="http://www.w3.org/2001/04/xmlenc#" 
    xmlns:sp="http://schemas.microsoft.com/sharepoint/" 
    xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" 
    xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" 
    xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" 
    xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" 
    xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" 
    xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" 
    xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" 
    xmlns:mver="http://schemas.openxmlformats.org/up-compatibility/2006" 
    xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" 
    xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" 
    xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" 
    xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" 
    xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" 
    xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" 
    xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" 
    xmlns:Z="urn:schemas-microsoft-com:" 
    xmlns:st="&#1;" 
    xmlns="http://www.w3.org/TR/REC-html40"><head>
    <meta http-equiv=Content-Type content="text/html; charset=gb2312">
    <meta name=Generator content="Microsoft Word 12 (filtered medium)">
    <!--[if !mso]>
    <style>
    v\:* {behavior:url(#default#VML);}
    o\:* {behavior:url(#default#VML);}
    w\:* {behavior:url(#default#VML);}
    ..shape {behavior:url(#default#VML);}
    </style>
    <![endif]--><!--[if gte mso 9]><xml>
     <o:shapedefaults v:ext="edit" spidmax="2050" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
     <o:shapelayout v:ext="edit">
      <o:idmap v:ext="edit" data="1" />
     </o:shapelayout></xml><![endif]-->
    </head><body><p class=MsoNormal><!--[if gte vml 1]>
       <v:shape id="Picture_x0020_5" o:spid="_x0000_s1049" type="#_x0000_t75" style='position:absolute;margin-left:9pt;margin-top:12pt;width:115.5pt;
       height:86.25pt;z-index:1;visibility:visible;mso-wrap-style:square;
       mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;
       mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;
       mso-position-horizontal:absolute;mso-position-horizontal-relative:text;
       mso-position-vertical:absolute;mso-position-vertical-relative:text'>
       <v:imagedata src="image001.jpg" o:title="" />
      </v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;
      position:absolute;z-index:1;margin-left:12px;margin-top:16px;width:154px;
      height:115px'><img width=154 height=115 src="image001.jpg" v:shapes="Picture_x0020_5"></span><![endif]><span
      lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
      color:black'><o:p></o:p></span></p><input type="button" name="b1" value="提交" onClick="ss()"><script language="javascript">function ss(){
        var obj=document.getElementsByTagName("v:imagedata");
        var id=[]
        for(var i=0;i<obj.length;i++)id.push(obj[i].getAttribute("src"));
        alert(id);
    }</script> </body></html>
    这个还有问题.
      

  5.   

    我简化了一些内容还是不行.<html 
    xmlns:v="urn:schemas-microsoft-com:vml" 
    xmlns="http://www.w3.org/TR/REC-html40"><head>
    <meta http-equiv=Content-Type content="text/html; charset=gb2312">
    <meta name=Generator content="Microsoft Word 12 (filtered medium)">
    <!--[if !mso]>
    <style>
    v\:* {behavior:url(#default#VML);}
    </style>
    <![endif]--></head><body><!--[if gte vml 1]>
       <v:shape style='position:absolute;margin-left:9pt;margin-top:12pt;width:115.5pt;
       height:86.25pt;z-index:1;visibility:visible;mso-wrap-style:square;
       mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;
       mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;
       mso-position-horizontal:absolute;mso-position-horizontal-relative:text;
       mso-position-vertical:absolute;mso-position-vertical-relative:text'>
       <v:imagedata src="image001.jpg" o:title="" />
      </v:shape>
    <![endif]--><input type="button" name="b1" value="提交" onClick="ss()"><script language="javascript">function ss(){
        alert(document.getElementsByTagName("v:imagedata").length);
    }</script> </body></html>
      

  6.   

    加了这名就不行了.<html 
    xmlns:v="urn:schemas-microsoft-com:vml"
      

  7.   

    本帖最后由 net_lover 于 2010-03-04 14:10:42 编辑
      

  8.   

    alert(document.getElementsByTagName("imagedata").length);