当前位置:编程学习 > C#/ASP.NET >>

为什么JS不能读取后台定义的变量的值啊

前台JS:
<script type="text/javascript">
                                linkarr = new Array();
                                picarr = new Array();
                                textarr = new Array();
                                var focus_width=296;
                                var focus_height=240;
                                var text_height=18;
                                var swf_height = focus_height+text_height;
                                var pics = "";
                                var links = "";
                                var texts = "";
                                linkarr[1] = '<%=title1%>';
                                picarr[1]  = "File/userfiles/images/<%=image1%>";
                                textarr[1] = '<%=title1%>';
                                
                                linkarr[2] = "a/gongzuodongtai/2010/1206/183.html";
                                picarr[2]  = "File/userfiles/images/2.jpg";
                                textarr[2] = "我院成功举办第六届科普知识竞赛";
                                
                                linkarr[3] = "a/gongzuodongtai/2010/1126/171.html";
                                picarr[3]  = "File/userfiles/images/3.jpg";
                                textarr[3] = "我院举行“安全教育月”启动仪式";
                                
                                linkarr[4] = "a/gongzuodongtai/2010/1126/171.html";
                                picarr[4]  = "File/userfiles/images/4.jpg";
                                textarr[4] = "我院举办学生党支部易做图培训班";
                                
                                for(i=1;i<picarr.length;i++){
                                  if(pics=="") pics = picarr[i];
                                  else pics += "|"+picarr[i];
                                }
                                for(i=1;i<linkarr.length;i++){
                                  if(links=="") links = linkarr[i];
                                  else links += "|"+linkarr[i];
                                }
                                for(i=1;i<textarr.length;i++){
                                  if(texts=="") texts = textarr[i];
                                  else texts += "|"+textarr[i];
                                }
                                
                                document.write('<embed src="i/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DFDFDF" quality="Best" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
                        
                        </script>

后台代码:
 protected static string title1;
        protected static string image1;


        DataTable dtNews;//新闻
        protected void Page_Load(object sender, EventArgs e)
        {
            dtNews = SqlDal.getdata("select top 9 * from News order by DateTime desc");//新闻栏目


。。
为什么JS不能读取变量的值啊 --------------------编程问答-------------------- protected static string title1;
  protected static string image1;

你在LOAD里面给他们赋值了吗 --------------------编程问答-------------------- 你的title1和image1赋值没。。。。
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,