js 按钮不响应怎么解决

 $(function() {      
      $("#back").click(function() {       //返回按钮事件   
       location.href = "welcome.html";
                 });
     $("#search").click(function(){
     var deptno = $("#deptno").val();  
      var res = query("select * from emp where deptno=" + deptno + "");     //组装SQL语句并执行查询
       if(res != null){                //判断是否有返回值
                       //var res_2=query("select * from emp where deptno=" + deptno + ");
     sessionStorage['deptno'] = deptno;       //deptno是要查看员工的部门的编号,把该编号放入sessionStorage,
                        location.href = "get_dep_emp.html";
 }
                 });

             });
         </script>
     </head>
 <body>
         <div class="content">
             <h2 class="title">查询部门员工</h2>
             <hr />
             <table width="90%" align="center" class="tablelist">
                 <tr>
                     <td width="45%" align="right">部门编号:</td>
                     <td><input type="text" id="deptno" /></td>
                 </tr>
                 <td colspan="2" align="center">
                     <input type="submit" value=" 查询 " id="search"  class="button" />
                     <input type="button" value=" 返回 " id="back"  class="button" />
   </td>

             </table>
         </div>
     </body>

但是查询和返回两个按钮都没有响应。。纯属菜鸟,请大神指点

用chrome的console or Firebug看看有错没有先

用$.document(ready){

}把你的代码给包了....