1. How to Create a hyperlink in javasript
<Script type = "text/JavaScript">
// Method 1:
Location. href = 'website ';
// Method 2:
Document. write ('<a href = ""> text </a> ');
</Script>
2. Handle the tree control event applied to Ext
Tree_03.js
Copy codeThe Code is as follows:
Ext. onReady (function (){
Var root = new Ext. tree. TreeNode ({// tree, there is no function here, In json format
Id: 1,
Text: "linjq"
});
Var c1 = new Ext. tree. TreeNode ({
Text: "child 1"
});
Root. appendChild (c1 );
Root. appendChild (new Ext. tree. TreeNode ({
Text: "child 2 "}));
Var tree = new Ext. tree. TreePanel ({
Width: 100,
RenderTo: "content ",
Root: root
});
// C1.on ("click", function (node, event) {alert (node. text );});
// C1.on ("click", function () {document. write ('<a href = "index. jsp"> index. jsp </a> ')});
C1.on ("click", function () {location. href = "index. jsp "});
});
Copy codeThe Code is as follows:
<Link type = "text/css" rel = "stylesheet" href = "ext/resources/css/ext-all.css"/>
<Script type = "text/javascript" src = "ext/adapter/ext/ext-base.js"> </script>
<Script type = "text/javascript" src = "ext/ ext-all.js"> </script>
<Script type = "text/javascript" src = "tree_03.js"> </script>
</Head>
<Body>
<Div id = "content"> </div>
</Body>