我在网页上输入的<img/>标签,路径是从数据库中读取的,但是图片不能显示,我把网页保存为静态页后打开,它居然又能显示,求真相啊?

解决方案 »

  1.   

    把网页保存为静态页?
    你是直接把HTML源码直接存为htm文件吗?
    看下路径吧
      

  2.   

    是.aspx页面,表格什么的是放在string里面,在页面绑定的<%=printStr%>,在页面显示后,图片不能显示,但是,我另存为HTML后打开,图片能显示
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Hun.DBUtility;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;public partial class Print_RKD_BQ : System.Web.UI.Page
    {
        public static string Print = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(Request.QueryString["ID"]);
            DataBinddlBQ1(ID);
        }    
        private void DataBinddlBQ1(int ID)
        {
            StringBuilder m_PrintDataBuild = new StringBuilder();
            
            int RK_ID=ID;
            int count = Convert.ToInt32(DbHelperSQL.GetSingle("select count(*) from  TB_CCGL a inner join TB_CCGL_XX_LS b on a.RK_PZNum=b.RK_PZBH  where a.ID="+RK_ID+" "));
            count = count / 4+1;
            for (int i = 0; i < count; i++)
            {
                m_PrintDataBuild.Append("<tr><td width=\"200px\"></td>");
                //(memo)m_PrintDataBuild.Append("<tr><td valign=\"top\" height=\"25\"><table width=\"700\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
                SqlParameter[] Param ={
                            new SqlParameter("@ID",SqlDbType.Int),
                            new SqlParameter("@i",SqlDbType.Int)
                };
                Param[0].Value = RK_ID;
                Param[1].Value = i;
                SqlDataReader ds=DbHelperSQL.RunProcedure("Pr_RKPrintBQ_Show",Param);
                int ds_row=0;
                while (ds.Read() && ds.HasRows)
                {
                    m_PrintDataBuild.Append("<td width=\"200px\" align=\"left\"><table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" id=\"DgdCompany\" style=\"color:#333333;width:180;border-collapse:collapse;\"><tr><td>品&nbsp;&nbsp;&nbsp; 名:</td><td>");
                    m_PrintDataBuild.Append(ds["RK_PM"]);
                    m_PrintDataBuild.Append("</td></tr><tr><td>条&nbsp;&nbsp;&nbsp; 码:</td> <td><img src=\"");
                    
                    m_PrintDataBuild.Append(ds["RK_TM"]);
                    m_PrintDataBuild.Append("\" /></td></tr><tr><td>入库时间:</td><td>");
                    //m_PrintDataBuild.Append("</td></tr><tr><td>条&nbsp;&nbsp;&nbsp; 码:</td> <td><table><tr><td><img src=\"");                //m_PrintDataBuild.Append(ds["RK_TM"]);
                    //m_PrintDataBuild.Append("\" /></td></tr><tr><td class=\"style1\">");
                    //m_PrintDataBuild.Append(ds["RK_WZBH"]);
                    //m_PrintDataBuild.Append("</td></tr></table></td></tr><tr><td>入库时间:</td><td>");
                    m_PrintDataBuild.Append(ds["RK_Date"]);
                    m_PrintDataBuild.Append("</td></tr><tr><td><img src=\"" + ds["RK_TM"] + "\" /></td><tr></table><br/><br/></td>");
                    ds_row=ds_row+1;
                }
                if (ds_row==1)
                {
                    m_PrintDataBuild.Append("<td></td><td></td><td></td>");
                }
                else if (ds_row==2)
                {
                    m_PrintDataBuild.Append("<td></td><td></td>");
                }
                else if (ds_row == 3)
                {
                    m_PrintDataBuild.Append("<td></td>");
                }
                
                
                m_PrintDataBuild.Append("<td width=\"auto\"></td>");
                //(memo)m_PrintDataBuild.Append("</tr></table></td><tr>");
                m_PrintDataBuild.Append("</tr>");
            }
            
            Print = m_PrintDataBuild.ToString();
        }
        
    }
      

  4.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Print_RKD_BQ.aspx.cs" Inherits="Print_RKD_BQ" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>入库物资标签打印</title>
    <%--<link href="css/dosensoft.css" type="text/css" rel="stylesheet" />
    <link href="css/style_2007.css" type=text/css rel=stylesheet />--%>
    <script  language="javascript" src="purchase/controls/NormalDialog.js"></script>
    <style type="text/css" media="print">  
     .Noprint{display:none;}<!--用本样式在打印时隐藏非打印项目-->  
    </style> 
    <script type="text/javascript">
        function closeie() {
            window.top.opener = '';
            window.top.close();
        }
    </script>
        <script type="text/javascript" src="js/rightclick.js" ></script>
        <script src="Scripts/AC_ActiveX.js" type="text/javascript"></script>
    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
        -->
    </style>
    </head>
    <body style="overflow:auto;margin:0 auto;color:#000000;">
    <form id="Form1" runat="server" >
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="bot_del">
      <tr>
        <td class="Noprint"></td>
      </tr>
      <tr>
        <td class="Noprint" ><script type="text/javascript">
                                AC_AX_RunContent('id', 'WebBrowser', 'height', '0', 'width', '0', 'classid', 'CLSID:8856F961-340A-11D0-A96B-00C04FD705A2', 'viewastext', 'VIEWASTEXT'); //end AC code
    </script>
          <noscript>
            <object id="OBJECT1" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" viewastext="VIEWASTEXT">
            </object>
            </noscript>
          <br /></td>
      </tr>
      <tr>
        <td class="Noprint" align="right" ><input onclick="document.all.WebBrowser.ExecWB(6,6)" type="button" value="直接打印"/>
        &nbsp; 
          <input onclick="document.all.WebBrowser.ExecWB(8,1)" type="button" value="页面设置"/>
          &nbsp; <input onclick="document.all.WebBrowser.ExecWB(7,1)" type="button" value="打印预览"/>
          &nbsp;
          <input type="button" value="返回" onclick="closeie()" />
          &nbsp; &nbsp;</td>
      </tr>
    </table>
    <table width="1000px" border="0" align="center" cellpadding="0" cellspacing="0" >
     
              
    <%=Print%>
                  <tr><td width="200px"></td><td width="200px" align="left"><br/><br/></td><td></td><td></td><td></td><td width="auto"></td></tr>
      </table>
    </form>
    </body>
    </html>