解决方案 »

  1.   

    这个可以对你有帮助,你只要把分隔线改成一个iframe就可以了,传值在changetd(tdcol)<%@ page contentType="text/html; charset=utf-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ include file="/header.jsp"%>
    <html>
    <head> <title>menu</title>
    <style type="text/css">
    .left_iframe {
    width: 180px;
    height: 92%;
    visibility: inherit;
    background: transparent;
    }.main_iframe {
    z-index: 1;
    width: 100%;
    height: 100%;
    visibility: inherit;
    }
    </style> <script type="text/javascript">
     //定义树型菜单的打开与关闭,
     function changetd(tdcol){
        var td1 = document.getElementById(tdcol);
        var wint =  parseInt(td1.style.width);
        var arr = document.getElementById("arrlr");
        if(wint>1){
            td1.style.width   =   "1px";
            arr.src="${ctx}/img/arrR.jpg"
        
        }else{
            td1.style.width   =   "200px";
             arr.src="${ctx}/img/arrL.jpg"
        }
        
        
     
     }
     
     
    var _winWidth = 180;
    var _winHeight = 575;
    /*******************************/
    /***** Colmid (CM) Object *****/
    /*******************************/
    function CM() {}
    CM.mouseover = function(p_o){p_o.style.backgroundColor = "#549FE3";}
    CM.mouseout = function(p_o){p_o.style.backgroundColor = "#54BCCC";}
    CM.mousedown = function(p_ev){
    p_ev = (p_ev) ? p_ev : event;
    CM.ismousedown = true;
    CM.currpos = p_ev.clientX;
    CM.currLeftW = CM.getCurrLeftW();
    document.body.style.cursor = 'e-resize';
    return false;
    }
    CM.mouseup = function(){
    CM.ismousedown = false;
    document.body.style.cursor = 'auto';
    CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
    return false;
    }
    CM.mousemove = function(p_ev){
    if (CM.ismousedown){
    p_ev = (p_ev) ? p_ev : event;
    var newpos = p_ev.clientX;
    var pxmoved = parseInt(newpos - CM.currpos);
    pxmoved = (document.body.dir == 'rtl') ?  -pxmoved : pxmoved;
    var newLeftW = parseInt(CM.currLeftW + pxmoved);
    var newRightW = getWinWidth() - newLeftW - CM.rightWAdj;
    if (newLeftW >= CM.minLeft && newRightW >= CM.minRight){
    document.getElementById("colleft").style.width = newLeftW + 'px';
    }
    return false
    }else return true;
    }
    CM.setMinLeft = function(){
    CM.minLeft = 1;    //控制左边窗口的最小值
    }
    CM.getCurrRightW = function(){
    return getWinWidth() - CM.getCurrLeftW() - CM.rightWAdj;
    }
    CM.getCurrLeftW = function(){
    if (CM.currLeftW == 0) CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
    return CM.currLeftW;
    }
    CM.ismousedown;
    CM.currpos;
    CM.currLeftW = 0;
    CM.minLeft;
    CM.minRight = 30;//控制右边窗口的最小值
    CM.rightWAdj = 21;//8+8+5
    /***** End Colmid (CM) Object *****/function getElemHeight(p_el){
    if (p_el.innerHeight) return p_el.innerHeight;
    else if (p_el.clientHeight) return p_el.clientHeight;
    else return p_el.offsetHeight;
    }
    function getWinHeight(){
    if (window.innerHeight) return window.innerHeight;
    else if (document.documentElement.clientHeight) return document.documentElement.clientHeight;
    else if (document.body.offsetHeight) return document.body.offsetHeight;
    else return _winHeight;
    }
    function getWinWidth(){
    if (window.innerWidth) return window.innerWidth;
    else if (document.documentElement.clientWidth) return document.documentElement.clientWidth;
    else if (document.body.offsetWidth) return document.body.offsetWidth;
    else return _winWidth;
    }
    function HandleOnLoad(){
    CM.setMinLeft();
    }
    /***** Attach events *****/
    window.onload = HandleOnLoad;
    </script>
    </head> <body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0"
              bgcolor="#cccccc" dir="ltr" onmouseup="return CM.mouseup();"
    onmousemove="return CM.mousemove(event);" >
    <link href="demo/styles/works.css" rel="stylesheet" type="text/css" />
    <link href="demo/styles/_MenuTree.css" rel="stylesheet"
    type="text/css" /><!-- 页面菜单 -->
    <div align="justify">
    <iframe style="width: 100%; height: 16%;" name="Screen1"
    src="${ctx}/jsMenu/sc1/sc1.jsp" scrolling="no" Frameborder="1%"
    marginheight="1" marginwidth="1" align="top">
                        </iframe>
    </div> <table style="width: 100%; height: 82%;" border="0">

    <tr>
    <!-- 树菜单   -->
    <td rowspan="0" style="width: 200px; height: 27px" id="colleft">
    <iframe id="I1" name="I1" src="${ctx}/jsMenu/submenu.html"
    class="main_iframe" allowtransparency="true" Frameborder="1%"
    marginheight="1">
    </iframe>
    </td>
    <!-- 定义分隔线的大小和图片 -->
    <td width="2" rowspan="1" id="colmid" style="cursor:url('${ctx}/img/imge11.ani')"
    onmouseover="CM.mouseover(this)" onmouseout="CM.mouseout(this)"
    onmousedown="return CM.mousedown(event)"
    onmouseup="return CM.mouseup();" bgcolor="#549FE3">
    <!-- <input type="image" name="imageField2" src="${ctx}/img/arrL.jpg" width="8" height="40" border="0" alt="" onclick="changetd('colleft')"/ >  -->
    <img src="${ctx}/img/arrL.jpg" width="8" height="40" border="0" id="arrlr"
    alt="" ondblclick="changetd('colleft')"  />
    </td> <!-- 页面内容(缺省)--> <td style="height: 27px" id="colright">
    <table style="width: 100%; height: 100%;">
    <tr style="width: 100%; height: 100%;">
    <td>
    <!--jdtc.jsp是进度条程序,指向zc_list.jsp文件--> <iframe id="I2" name="I2" scrolling="yes" Frameborder="1%"
    marginheight="1" src="${ctx}/servlet/SitetotalServlet?q=list"
    class="main_iframe">
    </iframe>
    </td> </td>
    </tr>
    </table>
    </tr>
    </table> <!--  <center>
    <a href="#" class="itemAnchor" onclick="" >TOP</a> 
    </center> -->
    </body>
    </html>
      

  2.   

    //分两大类1. 纯文本 2.有附件、图片
            if(attachFileNames==null&&imgFileNames==null){
              msg.setText(content);
              Transport.send(msg); 
            }else{
             //设置数据容器类型  mixed(没关系) related(调用关系) alternative 
              MimeMultipart msgMultipart=new MimeMultipart("mixed");
       msg.setContent(msgMultipart);
       
     
      //添加附件
      MimeBodyPart attch=null;
      String[] temp =attachFileNames.split(",");
     
        
     
     
              for(int   i=0;i<temp.length;i++){
               File file=new File(temp[i]);
               String filename=null;
               if(file.isFile()){
               filename=file.getName();
               }
               DataSource ds1=new FileDataSource(temp[i]) ;
              
               DataHandler dh1=new DataHandler(ds1);
               attch = new MimeBodyPart();
               System.out.println(attch);
               attch.setDataHandler(dh1);
               attch.setFileName(MimeUtility.encodeText(filename));
               //添加到信息对象
      msgMultipart.addBodyPart(attch);
              } 
              
             
              
             //主内容
      MimeBodyPart bodyContent=new MimeBodyPart();
      msgMultipart.addBodyPart(bodyContent);
      //html跟图片
      MimeMultipart bodyMultipart=new MimeMultipart("related");
      bodyContent.setContent(bodyMultipart);
     
      //添加主内容(包括文字跟图片)
       
      MimeBodyPart htmlPart=new MimeBodyPart();
      MimeBodyPart gifPart=new MimeBodyPart();
     
      bodyMultipart.addBodyPart(htmlPart);
      bodyMultipart.addBodyPart(gifPart);
     
      //内容中的图片
      DataSource gifds=new FileDataSource(imgFileNames) ;
      File file=new File(imgFileNames);
               String imgFilename=null;
               if(file.isFile()){
               imgFilename=file.getName();
               }
      DataHandler gifdh=new DataHandler(gifds);
      gifPart.setDataHandler(gifdh);
      gifPart.setFileName(MimeUtility.encodeText(imgFilename));
     
      //指定图片
      gifPart.setContentID(imgFilename);//定义正文内容引用id 
      htmlPart.setContent("<img src=cid:"+imgFilename+">"+content, "text/html;charset=utf-8");
      //生成内容
      msg.saveChanges();
              Transport.send(msg);    
            }
           
        } catch (AddressException e) {
             
        } catch (MessagingException e) {
            
        } catch (UnsupportedEncodingException e) {
    e.printStackTrace();


    return true;
    }


    public static void main(String[] args) {
    SendMailImpl.sendHtmlMail("[email protected],[email protected]", "测试", "E:\\文档.doc,E:\\2.txt", "呵呵", "E:\\logo.gif");
    }