ASP.NET 前台JS和后台的一个问题?
前台有个JS代码 里面有 新闻标题,图片,连接地址。。。就是 下面js代码的 pics texts links 这些内容<script type="text/javascript">
var width=457;var focus_height=201;var text_height=20;
var swf_height = focus_height+text_height;
var pics='';var links='';var texts='';
pics+='../image/indexnew/pic04.jpg|';
links+='mtbd/22241.htm|';
texts+='【新华网】国务院常务会议研究确定支持小型微型企业…|';
pics+='../image/indexnew/pic05.jpg|';
links+='mtbd/21662.htm|';
texts+='【人民网】香港市副市长崔津渡:完善市场发展 推动…|';
pics+='../image/indexnew/pic06.jpg|';
links+='mtbd/22356.htm|';
texts+='【金融界】陈宗胜:推进北方航运中心建设 尝试金融…|';
pics+='../image/indexnew/pic07.jpg|';
links+='mtbd/22281.htm|';
texts+='【新华网】中国共产党第十七届中央委员会第六次全体…|';
pics=pics.substring(0,pics.length-1);
links=links.substring(0,links.length-1);
texts=texts.substring(0,texts.length-1);
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+swf_height+'">');
document.write('<param name="movie" value="focus3.swf"/>');
document.write('<param name="quality" value="high"/><param name="bgcolor" value="#F0F0F0"/>');
document.write('<param name="menu" value="false"/><param name="wmode" value="opaque"/>');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+focus_height+'&textheight='+text_height+'"/>');
document.write('<embed src="../image/index/focus3.swf" width="'+width+'" height="'+swf_height+'" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" wmode="opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
document.write('</object>');
</script>
我的问题在这。。。我想在后台动态添加 图片地址 连接 标题pics+='../image/indexnew/pic07.jpg|';
links+='mtbd/22281.htm|';
texts+='【新华网】中国共产党第十七届中央委员会第六次全体…|';
请教 应该怎么做呢? 在下新人------解决方案--------------------
DataTable dt = DB.DbHelperSQL.Query("select top 6 * from picture p inner join upfile u on u.fid=p.fid order by p.taxis desc").Tables[0];
str += "<script type=\"text/javascript\" language=\"javascript\"> ";
string pics = "var pics='";
string links = "var links=";
string texts = "var texts='";
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["vrealname"] != null)
{
pics += dt.Rows[i]["vrealname"] + "|";
}
texts += dt.Rows[i]["title"] + "|";
links += "escape(\"" + dt.Rows[i]["url"] + "\")+\"|\"+";
}
if (dt.Rows.Count > 0)
{
str += pics.Substring(0, pics.LastIndexOf('|')) + "'; " + links.Substring(0, links.LastIndexOf('|')-2) + "; " + texts.Substring(0, texts.LastIndexOf('|')) + "'; ";
}
str += "var focus_width=325; var focus_height=228; var text_height=18; ";
str += "document.write('<object classid=\&q