当前位置: 代码迷 >> JavaScript >> 惯用的js代码
  详细解决方案

惯用的js代码

热度:101   发布时间:2012-12-23 11:28:15.0
常用的js代码
<script type="text/javascript">
  function topPage() {
  window.location="news_revert.jsp.jsp?pageNo=<%=pm.getTopPageNo()%>";
 }
 
 function previousPage() {
  window.location="news_revert.jsp?pageNo=<%=pm.getPreviousPageNo()%>";
 } 
 
 function nextPage() {
  window.location="news_revert.jsp?pageNo=<%=pm.getNextPageNo()%>";
 }
 
 function bottomPage() {
  window.location="news_revert.jsp?pageNo=<%=pm.getBottomPageNo()%>";
 }
 
   function deleteCrip() {
  var sel = document.getElementsByName("sel");
  var flag = false;
  for (var i=0; i<sel.length; i++) {
   if (sel[i].checked) {
    flag = true;
    break;
   }
  }
  if (!flag) {
   alert("请选择需要删除的评论!");
   return;
  }
  
  if (window.confirm("是否删除?")) {
   with (document.getElementById("newsform")) {
    action="news_revert.jsp?command=delete";
    method="post";
    submit();
   }
  }
 } 
  
 function selallcheck()
 {
      var sel = document.getElementsByName("sel");
   for (var i=0; i<sel.length;i++) 
   {  
      sel[i].checked=true;
   }  
 }
 
 function selclearcheck()
 {
      var sel = document.getElementsByName("sel");
   for (var i=0; i<sel.length;i++) 
   {  
           sel[i].checked=false;
   }  
 }
 
  //自动刷新页面
    function myrefresh(){
        window.location.reload();
    }
  
  function updateCrip() {
  var sel = document.getElementsByName("sel");
  var count = 0;
  var j = 0;
  for (var i=0; i<sel.length; i++) {
   if (sel[i].checked) {
    j = i;
    count++;
   }
  }
  if (count == 0) {
   alert("请选择需要修改的用户!");
   return;
  }
  if (count > 1) {
   alert("一次只能修改一个用户!");
   return;
  }
  //alert(selectFlags[j].value);
  //window.self.location = "new_update.jsp?cid=" + sel[j].value;
   window.open ("new_update.jsp?cid=" + sel[j].value, "newwindow", "height=400, width=600,top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=n o, status=no");
  //setTimeout('myrefresh()',40000);
    }

      function openjspwin(cid)
 {
     window.open ("new_update.jsp?cid=" +cid, "newwindow", "height=400, width=600,top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=n o, status=no");
 }
 
  </script>

?

  相关解决方案