当前位置:首页>开发>正文

jquery文档就绪函数怎么写 jquery文档就绪函数和asp.net ajax pageload方法有什么区别

2023-05-06 18:30:56 互联网 未知 开发

 jquery文档就绪函数怎么写 jquery文档就绪函数和asp.net ajax pageload方法有什么区别

jquery文档就绪函数怎么写

<script>
//这段代码放在jquery.js文件之后
$(document).ready(function(){
   //alert( "文档就绪啦")
})
<script>

jquery文档就绪函数和asp.net ajax pageload方法有什么区别

文档就绪就是指,整个页面已经加载完毕。

.net没有怎么研究,不过从字面意思看,应该是页面载入中,相当于jquery的load事件

一个是页面载入时执行的函数,一个是页面载入完成后执行的函数

关于jquery中append函数~~

jQuery 1.4 新增的。
这个操作与对指定的元素执行appendChild方法,将它们添加到文档中的情况类似。
function(index, html)
返回一个HTML字符串,用于追加到每一个匹配元素的里边。接受两个参数,index参数为对象在这个集合中的索引值,html参数为这个对象原先的html值。
----------------------------------------------------------------------
所以:
$("p").append(function(m,n){
return "This p element has index " (m n) ""
}
会得到:
This is a paragraph.This p element has index 0This is a paragraph.
This is another paragraph.This p element has index 1This is another paragraph.

也就是原有

中的内容 This p element has index 当前这个p的索引 p自身的内容

最新文章

随便看看