RegisterStartupScript和RegisterClientScriptBlock的区别

来源:互联网 发布:k11防水和js防水的区别 编辑:程序博客网 时间:2024/05/01 21:34

RegisterStartupScript和RegisterClientScriptBlock的区别

RegisterStartupScript是将js代码插入到生成页面的尾端。
而RegisterClientScriptBlock是将js代码插入到  生成的隐藏代码和body中页面代码之前。如下

RegisterStartupScript生成的代码
<body>
<input ....隐藏代码>
<p>hello</p>
<script>js代码</script>
</body>

RegisterClientScriptBlock生成的代码
<body>
<input ....隐藏代码>
<script>js代码</script>
<p>hello</p>
</body>
原创粉丝点击