页面js
<script type="text/javascript">
//onload 函数
$(function() {
//初始化 showadd的click函数 切换adddiv 的显示状态
$("#showadd").click(function(){
$('#adddiv').toggle();
});
//一级开始
$("a[@name*=addonenode]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
$('#showonenode'+t).toggle();
$('#name'+t).val("");
$('#url'+t).val("");
});
$("a[@name*=cancel]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
$('#showonenode'+t).toggle();
});
$("a[@name*=besure]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
var name = $('#name'+t).val();
var url = $('#url'+t).val();
var grade = $('#grade'+t).val();
var ftid = $('#ftid'+t).val();
$.ajax({
type: "POST",
url: "<%=basePath%>functiontreeOS.do?method=insertnodefunctions",
data: "name="+name+"&url="+url+"&grade="+grade+"&ftid="+ftid+"&typeone="+$("#typeone").val(),
success: function(msg){
$('#showonenode'+t).toggle();
$('#twonode'+t).html(msg);
}
});
});
//一级结束
//二级开始
$("a[@name*=addtwonode]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
$('#showtwonode'+t).toggle();
$('#cname'+t).val("");
$('#curl'+t).val("");
});
$("a[@name*=ccancel]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
$('#showtwonode'+t).toggle();
});
$("a[@name*=cbesure]").click(function(){
var t = this.id.substring(this.id.length-1,this.id.length);
var name = $('#cname'+t).val();
var url = $('#curl'+t).val();
var grade = $('#cgrade'+t).val();
var ftid = $('#cftid'+t).val();
$.ajax({
type: "POST",
url: "<%=basePath%>functiontreeOS.do?method=insertnodefunctions",
data: "name="+name+"&url="+url+"&grade="+grade+"&ftid="+ftid+"&typetwo="+$("#typetwo").val(),
success: function(msg){
$('#showtwonode'+t).toggle();
$('#ctwonode'+t).html(msg);
//alert(msg);
}
});
});
//二级结束
});
</script>
Api download