日期:2014-05-20  浏览次数:20771 次

c#不能连续调用js函数,怎么办?谢谢!
有个js函数shPos(o1,o2)
在c#调用:
        string   o1,o2;
        o1= "B1 ";o2= "B2 ";
        Page.RegisterStartupScript( " ", " <script> shPos( ' "   +   o1   +   " ', ' "   +   o2   +   " ') </script> ");
      o1= "B3 ";
      o2= "B4 ";
        Page.RegisterStartupScript( " ", " <script> shPos( ' "   +   o1   +   " ', ' "   +   o2   +   " ') </script> ");
只有第一次调用执行.第二次调用没反应.
还有其它方法调用js函数?
谢谢!

------解决方案--------------------
string o1,o2;
o1= "B1 ";o2= "B2 ";
Page.RegisterStartupScript( "js1 ", " <script> shPos( ' " + o1 + " ', ' " + o2 + " ') </script> ");
o1= "B3 ";
o2= "B4 ";
Page.RegisterStartupScript( "js2 ", " <script> shPos( ' " + o1 + " ', ' " + o2 + " ') </script> ");
------解决方案--------------------
Page.RegisterStartupScript( "first ", " <script> shPos( ' " + o1 + " ', ' " + o2 + " ') </script> ");
...
Page.RegisterStartupScript( "two ", " <script> shPos( ' " + o1 + " ', ' " + o2 + " ') </script> ");