DBDataSet.tblAdsDataTable dtAds = client.getAdsDate(ref errCode, AdsType, AdsSlot, Country);
string ss = "";
string aa = "";
if (dtAds.Rows.Count > 0)
{
foreach (DBDataSet.tblAdsRow dr in dtAds)
{
DateTime date = dr.AdsDate;
string AdsDate = date.ToString("dd/MM/yyyy");
ss += '"' + AdsDate + '"' +",";
aa = ss.TrimEnd(','); // equal to "01/01/2018","02/01/2018"
string jquery = "var naArray = ["+ aa +"];";;
ClientScript.RegisterStartupScript(typeof(Page), "a key","<script>" + jquery + "</script>");
}
}
嗨,从上面的代码中,我想在后面的代码中添加 javascript 像<script> var naArray = ["01/01/2018","02/01/2018"];</script>. 但是,当我执行时,它变成<script> var naArray = ["01/01/2018"]; <script>了数组中缺少的“02/01/2018”。感谢是否有人可以对此提供帮助。谢谢。
相关分类