首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

急img添加汉字解决思路

2012-04-26 
急急急急急急急急急急急急急急急急!!!img添加汉字HTML code%@ Page LanguageC# %!DOCTYPE html PUBL

急急急急急急急急急急急急急急急急!!!img添加汉字

HTML code
<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">  protected void Page_Load(object sender, EventArgs e)  {    if (!Page.IsPostBack)    {      System.Data.DataTable dt = new System.Data.DataTable();      System.Data.DataRow dr;      dt.Columns.Add(new System.Data.DataColumn("3月13日", typeof(System.String)));      dt.Columns.Add(new System.Data.DataColumn("3月14日", typeof(System.String)));      dt.Columns.Add(new System.Data.DataColumn("3月15日", typeof(System.String)));      String[] x = { "10%", "20%", "50%", "80%", "90%","100%" };      Random r = new Random();      for (int i = 0; i < 8; i++)      {        dr = dt.NewRow();        dr[0] = x[r.Next(0, x.Length)];        dr[1] = x[r.Next(0, x.Length)];        dr[2] = x[r.Next(0, x.Length)];        dt.Rows.Add(dr);      }      GridView1.DataSource = dt;      GridView1.DataBind();    }  }</script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"></head><body>  <form id="form1" runat="server">  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">  <Columns>  <asp:TemplateField HeaderText="3月13日">  <ItemTemplate>  <div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月13日") %></span></div>    <div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月13日") %>" height="20" /></div>  </ItemTemplate>  </asp:TemplateField>  <asp:TemplateField HeaderText="3月14日">  <ItemTemplate>  <div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月14日") %></span></div>    <div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月14日") %>" height="20" /></div>  </ItemTemplate>  </asp:TemplateField>  <asp:TemplateField HeaderText="3月15日">  <ItemTemplate>  <div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月15日") %></span></div>    <div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月15日") %>" height="20" /></div>  </ItemTemplate>  </asp:TemplateField>  </Columns>  </asp:GridView>  </form></body></html>

如何可以在img里面加上文字呢?我加了之后就是显示不出来

[解决办法]
你的是ie6吧。其他浏览器都是正确的
[解决办法]
你直接设置div或者table单元格的style样式,添加背景图片不就行了,又不影响文字的添加

<div style="backgroud-img('img/1.jpg')" >文字</div>
<table><tr><td style="backgroud-img('img/1.jpg')"> 文字</td></tr></table>

热点排行