+++++++++++++++++ First case:
1. Background method:
Protected string Csharpvoid (String STRCC)
{
return STRCC;
}
2.javascript Call
<script language= "JavaScript" >
var s = "<%=csharpvoid (" www.esoutong.com ")%>";
document.write (s);
</script>
+++++++++++++++++ the second case:
1. Post Code:
protected void csharpvoid ()
{
String STRCC = "www.esoutong.com";
Response.Write (STRCC);
}
2. Calling method: Csharpvoid ()
<script language= "JavaScript" >
document.write ("<%csharpvoid ();%>");
</script>
You can put a button on the page, set it to invisible style= "Display:none", and then use the script to make this button click
document.all ("Button1"). Click ();
Write the event code in the C # Background of this button, which is the simplest script to invoke the C # method.
On the Internet to see this problem: The author uses the platform is. NET, with C # in the native development, in the ASPX file to call JS file:
<script language= "javascript" src= "Mymenu.js" ></script>
Results in the page and alert hint of the Chinese are garbled, to find solutions. The results are followed by a long list of solutions, in fact very simple, in the head of the ASPX file to add a line of code can:
<%@ Page contenttype= "text/html" responseencoding= "gb2312"%>