首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c#不能连续调用js函数,如何办?多谢

2011-12-22 
c#不能连续调用js函数,怎么办?谢谢!有个js函数shPos(o1,o2)在c#调用:stringo1,o2o1 B1 o2 B2 Pag

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> ");

热点排行