|
ClientScript.RegisterStartupScript
This is usually added at the beginning of the form
<form id = "form1" ...> <!-added here at the beginning->
<script>
some code
</ script>
</ form>
Response.Write is generally where you add the script where you write
ClientScript.RegisterStartupScript There is also a RegisterBlock xxx I can't remember, it is to add the script before the end of the form tag
The location of the script generally has no effect, but sometimes the Internet speed is slow. When the entire web page is not loaded and played, the <script> in the body tag is loaded first, and then it will be executed first. But some objects haven't been loaded recently, an error will occur, saying that the object does not exist.
<Script defer = "defer" type = "text / javascript" language = "javascript"> </ script>
Adding defer can delay the script running, and then run the script after the web page is loaded. |
|