JS:
var s = "<% Response.Write(test1("abc")); %>"; //Write(); 后需加 ;
alert(s);
var s2 = "<%=test1("abc") %>"; //= 后不能加 ;
alert(s2);
var s3="<%test2("bcd"); %>"; //无返回值不能用 = 和response.write
alert(s3);
c#:
public string test1(string str)
{
return "test1"+str;
}
public void test2(string str)
{
Response.Write("test2"+str);
}