1、$(function(){})
$(document).ready(function(){
doSomething();
})
替换掉下面的一切。
//document.body.onload=init IE支持
window.onload = init Dom标准
$(function() { Jquery方式 成功
//function init(){
2、JQUERY回调函数的使用
/// <reference path="jquery-1.3.2-vsdoc2.js" />
$(function() {
//var d = web_TreeView_TreeDemo.GetData('dd').value;
var data = web_TreeView_TreeDemo.GetJson().value;
data = eval('(' + data + ')');
//{"Table":[{},{}]}
data = data.Table || {}; ;
$("#tree").showTree({ data: data, callback: function(t) {
//此处的关键传值
//是否可用 data:data,待测试
t = t || window.event;
doSomething(t);
}
});
//fn(this, _self); TreeView
function doSomething(event) {
var $this = $(event); //把当前的值转换成jQuery对象
TreeNodeClick(data[parseInt($this.attr("no"))].url + '?flowid=' + data[parseInt($this.attr("no"))].id, 'main', data[parseInt($this.attr("no"))].windowtype, data[parseInt($this.attr("no"))].dialogwidth, data[parseInt($this.attr("no"))].dialogheight);
//alert($this.attr("no"));
}
//$(:text").bind("keyup", function(event) {
//event = event || window.event;
//var target = event.target; //这个就是触发事件的控件
//});
//$("a.demo").click(function() { window.open(url, target, "") });