with variable
String id = request.querystring["id"]. ToString ();
Response.Write ("<script>alert" (' success '); Window.location.href (' reply.aspx?word_id= ' +id+ "');</script>");
int id=1;
String ip = Request.UserHostAddress.ToString ();
Response.Write ("<script>window.location.href" ("reply.aspx?word_id=" +id+ "&ip=" +ip+ "");</script> " );
The string and the value are carried the same.
Note:
1. Front Desk with parameters
<a href= "default.aspx?id=<% #Eval (" word_id ")%>" > Delete </a>
2. Background with parameters
Response.Redirect ("default.aspx?id=" +id);
Response.Redirect ("reply.aspx?id=" + ID + "&username=" + IP); ( multiple parameters to carry )
Question 1 How to access C # functions in JavaScript
Method One: 1, first establishes a button, in the backstage will call or the processing content writes in the Button_Click;
2, in the foreground to write a JS function, content for document.getElementById ("BTN1"). Click ();
3, in the foreground or backstage call JS function, fire click event, equal access to the background C # function;
Method Two: 1, function declared as public or protected
public string SS ()
{
Return ("a");
}
2, in the HTML used to call
There are several ways to do not enumerate, the younger brother often use is the above two kinds.
Question 2. How do I access C # variables in JavaScript?
Method One: 1, through the page hidden domain access
Method Two: 1, such as the background definition of public STRING N; foreground JS reference to the variable in the format of "or + +"
Method Three: 1, background registration script
" "
TMP is a background variable, and then you can directly access the temp to get the value in JS.
Question 3. How do I access the existing variables of JavaScript in C #?
Method One: 1, the foreground uses the static text control to hide the domain, writes the JS variable value to it;
2, the backstage uses request["the ID" to obtain the value;
Method Two: Cookie or session
Question 4. How do I access JavaScript functions in C #?
Method One: Page.registerstartupscript ("fuc", "");