欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

用jQuery向div中添加Html文本內(nèi)容的簡單實(shí)現(xiàn)

 更新時(shí)間:2016年07月13日 10:36:42   投稿:jingxian  
下面小編就為大家?guī)硪黄胘Query向div中添加Html文本內(nèi)容的簡單實(shí)現(xiàn)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

前臺(tái)代碼:

<link href="http://www.dbjr.com.cn/Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://www.dbjr.com.cn/Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="http://www.dbjr.com.cn/Scripts/jquery-ui.js" type="text/javascript"></script>
function PoeviewExcel() {
  $.ajax(
  {
   url: "send/index",
   type: "post",
   success: function (data) {
    var divshow = $("#showInfo2");
    divshow.text("");// 清空數(shù)據(jù)
    divshow.append(data); // 添加Html內(nèi)容,不能用Text 或 Val
    divshow.dialog({
     title: "短信群發(fā)系統(tǒng)",
     height: 250,
     width: 580
    });

   }
  }
  );
  return false;
 }
<a href="#" onclick="return PoeviewExcel()">預(yù)覽數(shù)據(jù)</a> 
<div id="divPreview" style="display: none">  
<text id="showInfo2"></text> 
</div>

后臺(tái)(主要):

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>序號(hào)</strong></td>"
     + " <td align='center'><strong>目標(biāo)手機(jī)號(hào)</strong></td>"
     + " <td align='center'><strong>發(fā)送內(nèi)容</strong></td>"
     +"</tr>";
   for (int i = 0; i < dt.Rows.Count; i++)
   {
    content += "<tr>"
     + " <td width='50' align='center'>" + i.ToString()+"</td>"
     + " <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內(nèi)容,不能用Text 或 Val

當(dāng)然用 after();會(huì)在該div中不斷追加信息。

如果用Text:顯示加載的文本內(nèi)容;

如果用Val:點(diǎn)擊鏈接第一次為空窗口,再點(diǎn)擊才出現(xiàn)數(shù)據(jù)顯示、

以上這篇用jQuery向div中添加Html文本內(nèi)容的簡單實(shí)現(xiàn)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論