独特的二级联动实现方式

每天在java的深海遨游,不断的去探索新的发现。

现将我的二级联动步骤呈上:

1.     引入标签库:<%@ taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>

2.     设置下拉框,遍历查询结果:

3.     绑定onChange()事件,传递参数:

     onChange="show_sub(this.options[this.options.selectedIndex].value)"

4.     Js事件

function changeMacroClass(macroCode){

 var url = "Animal!queryForSubClass.action";

 new Ajax.Updater('sub',url,{

         method:'post',

         evalScripts:true,

         parameters:{"bo.subClassify":macroCode},

         onComplete : function(){

               $("#sub").html("#newsub"); 

  }

 });

}

5.     刷新页面的内容 result.jsp

 

              

                     

              

 

 

你可能感兴趣的:(java)