用过Dtree的请进。

zhgwbzhd zhgwbzhd 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dtree</title>

<link rel="StyleSheet" href="js/dtree/dtree.css" type="text/css" />
<script type="text/javascript" src="js/dtree/dtree.js"></script>

</head>

<body>
<div class="dtree">
<script type="text/javascript">
<!--

MY_DTree = new dTree('MY_DTree');//创建树,名称为'MY_DTree',和树的对象变量名必须一致。

alert(MY_DTree);
//alert(MY_DTree.toString());

document.write(MY_DTree);

//-->
</script>

</div>
</body>

</html>
----------------------------------------------------------
我的问题如下:
只是一个new dTree()。并且在他的js内的function dTree(objName)内也没发现有关其他的函数的调用。
此时 alert(MY_DTree)和alert(MY_DTree.toString())是一样的,有内容出现。就是
<div class="dtree">
</div>
也就是调用了函数
dTree.prototype.toString = function() {

var str = '<div class="dtree">\n';

if (document.getElementById) {
//只要用new dTree('树名'),就可以到这里。

if (this.config.useCookies) this.selectedNode = this.getSelected();

str += this.addNode(this.root);

} else str += 'Browser not supported.';

str += '</div>';

if (!this.selectedFound) this.selectedNode = null;

this.completed = true;

alert(str);

return str;

};

请问各位,什么时候调用的啊。
没看出来啊。

...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
zhgwbzhd
JavaScript 87,983 成员 224,681 内容