function action(o,e) //函数改成这样
{
alert("action");
}xmlTree.prototype.Displaytree = function(id) //{
this.html = '<input id="BtnDel" type="button" value="test" onclick="action (this,event);">'; //---------这里的action失效,如何改?
return this.html;
}
{
alert("action");
}xmlTree.prototype.Displaytree = function(id) //{
this.html = '<input id="BtnDel" type="button" value="test" onclick="action (this,event);">'; //---------这里的action失效,如何改?
return this.html;
}
----------------------------------------------
<script language="javascript">
function xmlTree(name)
{
this.name = name;
this.html = '';
}xmlTree.prototype.createTree = function (obj) //生成树
{
document.write("<div id='tree'><\/div>");
var curHtml=this.Displaytree();
document.getElementById('tree').innerHTML = curHtml;}xmlTree.prototype.action = function (o,e)
{
alert("action");
}xmlTree.prototype.Displaytree = function(id) {
this.html = '<input id="BtnDel" type="button" value="test" onclick="action (this,event);">'; //---------这里的action失效,如何改?
return this.html;
}function action(){
alert('d');
}
</script><head>
<title>Untitled Page</title>
</head>
<body>
<script>
var tree = new xmlTree('tree');
tree.createTree ();
</script>
</body>
</html>
{
this.name = name;
this.html = '';
this.xmldom;
}
xmlTree.prototype.action = function (o,e)
{
cols = this.xmldom.parentNode.getElementsByTagName("ul");
***
}xmlTree.prototype.createTree = function (obj) {
this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
this.xmldom.async = false;
this.xmldom.load(this.xmlFile);
var curHtml=this.Displaytree();
document.write("<div id='tree'><\/div>");
document.getElementById('tree').innerHTML = curHtml;
}action = function (o,e)
{
alert(this.xmldom.parentNode.getElementsByTagName("ul"));
//-!!报错"this.xmldom.parentNode" is null or not an object
cols = this.xmldom.parentNode.getElementsByTagName("ul");
}xmlTree.prototype.Displaytree = function(id) //{
this.html = '<input id="BtnDel" type="button" value="test" onclick="action (this,event);">';
return this.html;
}
this.xmldom就是这个XML啊