asp.net 用前台js获得后台传来的方法值或变量值

asp.net 用js获得后台传来的方法值或变量值

关键字: cs 类 文s件 js 传值 javascript 获得 后台方法 值 变量

传变量值:

html js中 
Html代码
  1. var srcUrl = <%=getUrl%>;  
var srcUrl = <%=getUrl%>;


cs类文件中

C#代码
  1. public static string getUrl = "http://www.hao123.com/logo.gif";  
public static string getUrl = "http://www.hao123.com/logo.gif";


传方法值:

html js中 
s
Html代码
  1. var srcUrl = <%=getUrl()%>;  
var srcUrl = <%=getUrl()%>;


cs类文件中

C#代码
  1. public static string getUrl()   
  2. {   
  3.         return  "http://www.hao123.com/logo.gif";   
  4. }  
public static string getUrl(){        return  "http://www.hao123.com/logo.gif";}


posted @ 2010-12-09 14:26  学永不止步  阅读(11447)  评论(1)    收藏  举报