We quiz the way to answer them C # and JAVASCRIPT function call each other: 1. How JavaScript to access C # functions? 2. How JavaScript to access C # variable? 3. How the C # to access JavaScript existing variable? 4. How to access the JavaScript function in C #? Question 1 The answer is as follows: ,
belstaff panther jacket
javaScript function to execute C # code function:
Method One: 1, first create a button, in the background to deal with the contents of the call or write button_click in;
2, at the front desk to write a js function,
belstaff jackets sale, says document.getElementById (\c # function;
Method Two: 1,
belstaff jackets, the function is declared as public
background code (the public can also be changed to protected)
following is quoted fragment:
public string ss ()
{
return (\
var a = \;
alert (a);
Method three: 1, / /
//]]>
following is quoted fragment:
;
following is quoted fragment:
script language = \
{
if (event.keyCode == 13)
; {
event.cancelBubble = true;
event.returnValue = false;
document.all.FunName . value = \);
}
}
in. CS there:
following is quoted fragment:
public Page_OnLoad ()
{
if (! Page.IsPost ())
{
string strFunName = Request.Form [\value determines which function is called
switch (strFunName)
{
case \; Other \> public void enter ()
{
/ / ... ... such as the calculation of a value
}
Question 2. how to access the C # variables in JavaScript?
question is as follows:
Method One: 1, through a hidden field on the page to access var temp = \
Question 3. How to access JavaScript in C # existing variables?
question is as follows:
Method One: 1, front hidden field with static text control,
belstaff jacken, the variable values written into the js;
2, the background with the request [\javaScript function to execute the code:
Method One: 1,
belstaff leather jacket, Page.RegisterStartupScript (\:
private void Button2_Click (object sender, System.EventArgs e)
{
string str;
str = \Literal1.Text = str;
}