用jQuery向div中添加Html文本内容
前台代码:
<link href=" " rel="stylesheet" type="text/css" />
<script src=" " type="text/javascript"></script>
<script src=" " type="text/javascript"></script>
<script src=" " type="text/javascript"></script>
<script src=" " type="text/javascript"></script>
function PoeviewExcel() {
$.ajax(
{
url: "send/index",
type: "post",
success: function (data) {
var divshow = $("#showInfo2");
("");// 清空数据
divshow.append(data); // 添加Html内容,不能用Text 或 Val
$.ajax(
{
url: "send/index",
type: "post",
success: function (data) {
var divshow = $("#showInfo2");
("");// 清空数据
divshow.append(data); // 添加Html内容,不能用Text 或 Val
divshow.dialog({
title: "短信发系统",
height: 250,
width: 580
});
}
}
);
return false;
}
title: "短信发系统",
height: 250,
width: 580
});
}
}
);
return false;
}
<a href="#" onclick="return PoeviewExcel()">预览数据</a>
<div id="divPreview" style="display: none">
<text id="showInfo2"></text>
</div>
<div id="divPreview" style="display: none">
<text id="showInfo2"></text>
</div>
后台(主要):
public string GetImportReport()
{
DataTable dt = this.ImportExcel();
string content = String.Empty;
content = @"<table width='550' border='0' cellspacing='0' cellpadding='0' bgcolor='#D2D2D2'>"
+ " <tr bgcolor='#336699'>"
+ " <td align='center'><strong>序号</strong></td>"
+ " <td align='center'><strong>目标手机号</strong></td>"
+ " <td align='center'><strong>发送内容</strong></td>"
+"</tr>";
for (int i = 0; i < dt.Rows.Count; i++)
{
{
DataTable dt = this.ImportExcel();
string content = String.Empty;
content = @"<table width='550' border='0' cellspacing='0' cellpadding='0' bgcolor='#D2D2D2'>"
+ " <tr bgcolor='#336699'>"
+ " <td align='center'><strong>序号</strong></td>"
+ " <td align='center'><strong>目标手机号</strong></td>"
+ " <td align='center'><strong>发送内容</strong></td>"
+"</tr>";
for (int i = 0; i < dt.Rows.Count; i++)
{
content += "<tr>"
+ " <td width='50' align='center'>" + i.ToString()+"</td>"
html内容文本框 + " <td width='150' align='center'>" + dt.Rows[i][0].ToString() + "</td>"
+ " <td width='150' >" + dt.Rows[i][1].ToString() + "</td>"
+ " </tr>";
}
content += "</table>";
return content;
}
+ " <td width='50' align='center'>" + i.ToString()+"</td>"
html内容文本框 + " <td width='150' align='center'>" + dt.Rows[i][0].ToString() + "</td>"
+ " <td width='150' >" + dt.Rows[i][1].ToString() + "</td>"
+ " </tr>";
}
content += "</table>";
return content;
}
说明:
divshow.append(data); // 添加Html内容,不能用Text 或 Val
当然用 after();会在该div中不断追加信息。
如果用Text:显示加载的文本内容;
如果用Val:点击链接第一次为空窗口,再点击才出现数据显示、?????
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论