What are the problems with the JavaScript function of C #
This article introduces the relevant knowledge of "what are the problems of the JavaScript function of C #". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
How do I access C # variables in the JavaScript function? The answers are as follows:
Method 1: 1. Access through hidden fields on the page
< input id="xx" type="hidden" runat="server">Method 2: 1. If the background defines the format of referencing this variable in the PUBLIC STRING N; foreground js as'
< =n %>'or' +
< =n %>+ "
Method 3: or you can register a script on the page after the server-side variable assignment
"
< cript language='javascript'>Var temp= "+ tmp +"
< /script>"tmp is a background variable, and then temp can be accessed directly in js to get the value.
How do I access the existing variables of the JavaScript function in C #? The answers are as follows:
Method 1:
1. The foreground uses static text controls to hide the field and write the value of the js variable into it.
2. The background uses request ["id"] to get the value.
Method 2: you can use cookie or session
How to access the JavaScript function in C #? The answers are as follows:
Execute the JavaScript function in the c # code:
Method 1. Page.RegisterStartupScript ("ggg", "")
Method 2: use the Literal class, and then
Private void Button2_Click (object sender, System.EventArgs e) {string str; str= "; / / Literal1.Visible=true; Literal1.Text=str;}" what are the problems with the JavaScript function of C# ", thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!