string script = "<script>alert('Hello, world!');</script>"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myScript", script);
In this example, the RegisterClientScriptBlock method is called on the Page.ClientScript object with three arguments:
this.GetType(): This argument specifies the type of the current page or user control, which is used as a key to ensure that the script is registered only once.
“myScript”: This argument specifies a unique key for the script block, which can be used later to remove or replace the script.
<head> <script>alert('Hello, world!');</script> </head>
- - Adding and removing content in jQuery
- - Can I change the Dojo namespace to something other than dojo
- - How can I upload files asynchronously with jQuery
- - How do you capture mouse events in firefox
- - How to auto-size an iFrame