Go to registerstartupscript and registerclientscriptblock

Source: Internet
Author: User

Page. response. Write ("response test ;");

Page. registerstartupscript ("registerstartupscript", "registerstartupscript test ;");

Page. registerclientscriptblock ("registerclientscriptblock", "registerclientscriptblock test ");

The location after response. Write output is in the first line of the source file.

The location after registerclientscriptblock is output is in the next line of <form> (under the scripts of Asp.net and some hidden fields ).

The location after registerstartupscript output is in the previous line of </form>.

The prototype of registerclientscriptblock is the same as that of registerstartupscript.CodeThe client script is sent immediately after the start mark of the element of the page object is generated. The registerstartupscript is sent before the end mark of the element of the page object. If your script has a statement that interacts with the Page Object (doucument object), we recommend that you use registerstartupscript. If you want to execute the client script as early as possible, you can use registerclientscriptblock or response. write.

Registerclientscriptblock generally returns the packaging of client functions, while registerstartupscript returns the functions that will be executed after the document is loaded, similar to the functions in the body onload = "F ()" that we usually call; the two methods have different code positions in the client. registerclientscriptblock is after <form runat = Server>, while registerstartupscript is before </form>.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jianxue/archive/2008/03/31/2232289.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.