-1
           <div class="em-main" style="text-align: center">
        <div class="em-div-head" align="center"> E-Shop Jewellery </div>
           <div class="em-textbox" style="border:hidden">
              <input type="text" value="To:" name="recipient" style="width:97%">
           </div>
        <div id="em">
             <div class="em-middle">
              <div style="border-bottom:solid 1px #CCCCCC">
              <textarea class="em-textarea" onblur="if (this.value == '') { this.value='Write a 
                message..'; }" onfocus="if(this.value == 'Write a message..') { this.value = 
                  ''; }" value="Write a message.." name="message">Write a message..</textarea>
            </div>
            <div id="em_rt_tp_scroller" class="em_rt_tp_scroller">
            <div id="em-rightscrollerimage" style="border:none">
     <div class="em-mdimage"><img class="mail" src=" http://localhost:8080/weather
       /servlets.ImgDisplayServlet?id=D:\EML\workspace\assets\tried-
         imgs\18__1882_IMG_5731_203_173.png " alt="imagecontainer image" style="max-
           height:100%; max-width:100%;">
         <ul>
        <img id="em-delete" class="removeicon" width="7" height="7" title="Remove" bottom="10%" 
          src="jqe13/image/delete_s.PNG">
          </ul>
         </div>
         <div class="em-mdimage">
           <img class="mail" src=" http://localhost:8080/weather
              /servlets.ImgDisplayServlet?id=D:\EML\workspace\assets\tried-
              imgs\13__1882_IMG_5731_120_124.png " alt="imagecontainer image" style="max-
                height:100%; max-width:100%;">
             <ul>
             <img id="em-delete" class="removeicon" width="7" height="7" title="Remove"        
                  bottom="10%" src="jqe13/image/delete_s.PNG">
             </ul> 
         </div>
         <div class="em-mdimage">
          <img class="mail" src=" http://localhost:8080/weather
             /servlets.ImgDisplayServlet?id=D:\EML\workspace\assets\tried-
              imgs\15__1882_IMG_5731_341_137.png " alt="imagecontainer image" style="max-
               height:100%; max-width:100%;">
             <ul>
              <img id="em-delete" class="removeicon" width="7" height="7" title="Remove"    
                bottom="10%" src="jqe13/image/delete_s.PNG">
             </ul>
            </div>
           </div>
         </div>
        </div>
         <div class="em-bottom" align="center">
             <input id="SEND" type="button" value="send" name="">
              <input id="CANCEL" type="button" value="cancel" name="">
         </div>
       </div>
      </div>

上面的代码正在运行用于邮件的 html 代码,包括图像源。我将 3 个图像附加到 class="em-mdimage"。任何人都可以帮助我获取所有 3 个图像路径(如 D:\EML\workspace\assets\ Try-imgs\18__1882_IMG_5731_203_173.png )使用 jquery 。然后单击“发送”按钮时,我会将这 3 个路径发送到我的 servlet。我是 jquery 的新手。我尝试了一些选择器,但我没有得到这些路径。提前致谢。

4

2 回答 2

1

无法获取系统文件路径(例如,D:\EML\workspace\assets\tried-imgs\18__1882_IMG_5731_203_173.png

浏览器无权访问您的本地文件系统,当然 JavaScript 也无权访问远程文件系统。

您可以获取图像src属性

$("img").each(function(){
  console.log($(this).attr("src"));
});
于 2013-08-24T17:59:28.447 回答
-1

这对你有用, alert( $('img')[0].src );

于 2013-08-24T18:01:09.473 回答