Recently, I encountered a problem that the JS function's timeout settings failed. For exampleCode
1 Protected Void Page_load ( Object Sender, eventargs E)
2 {
3 If ( ! Ispostback)
4 {
5 String Target = Request. querystring [ " Target " ];
6 String Info = Request. querystring [ " Info " ];
7 If (Target ! = Null && Info ! = Null )
8 {
9 Lbinfo. Text = Info;
10 Hlredirect. navigateurl = Target;
11 Clientscript. registerclientscriptblock ( This . GetType (), " Startup " ,
" <Script language = 'javascript '> setTimeout (window. Location. href =' " + Target + " ', 2000) </SCRIPT> " );
12 }
13 }
14 }
Originally, I was trying to log on to a forum. After a successful login, the system will display "Login successful, transfer to the forum page later ......" By receiving URL parameters to display the prompt content and the page to be transferred. HoweverProgramDuring the execution, there was no waiting at all, and it was transferred directly. No matter how many timeout numbers are set later, it is useless. I checked the relevant information and used single quotation marks for the timeout time. I have been very depressed. I don't know which big brother can give me some advice to see what went wrong.
By the way, will this project be related to Asp.net Ajax-enabled web site.