日期:2014-05-16  浏览次数:20354 次

关于new出来对象的可访问域
在一个外部js中,。。函数initTree()中v = new Tree();
在html中
<body >

<div class="dtree">
<script type="text/javascript">
initTree();
</script>
</div>

<input id="devName" type="button" value="" onclick=“/*这里想调用TRee()对象的方法*/”/>


怎么才能用起来像使用document这种全局对象呢?(JS小白)

------解决方案--------------------
function initTree()
{
return new Tree();
}

var v = initTree();