++:
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>
++:
1. AfterCode:
Protected void csharpvoid ()
{
String strcc = "http://www.esoutong.com /";
Response. Write (strcc );
}
2. Call method: csharpvoid ()
<Script language = "JavaScript">
Document. Write ("<% csharpvoid (); %> ");
</SCRIPT>
You can place a button on the page and set it to invisible style = "display: none". Then, use a script to make this button click
Document. All ("button1"). Click ();
Write the Event code in the C # background of the button. This is the simplest script to call the C # method.
We can see this problem on the Internet: the platform used by the author is. net, developed on the local machine with C #, And the JS file is called in the aspx file:
<Script language = "JavaScript" src = "mymenu. js"> </SCRIPT>
The results are garbled characters on the page and alert prompts. The result is followed by a long string of solutions. In fact, it is very simple to add a line of code in the header of the aspx file:
<% @ Page contenttype = "text/html" responseencoding = "gb2312" %>
It's easy, huh, huh.