博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在JS中 onclick="save();return false;"return false是
阅读量:4095 次
发布时间:2019-05-25

本文共 2466 字,大约阅读时间需要 8 分钟。

//JavaScript中return false的用法,在大多数情况下,为事件处理函数返回false,可以防止默认的事件行为。

       比如:<input type="submit" οnclick="submitAction(); return false;" />

submitAction 方法里面有提交表单的动作。万一不加 return false,在执行完 submitAction 方法后,

submit 按钮还会继续执行它的默认事件(提交表单),加上return false后,则不会再执行提交表单的动作 

<%@page import="com.pb.news.util.PageSupport"%><%@page import="com.pb.news.entity.News"%><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ include file="../../common/common.jsp" %>  
新闻分类:
新闻标题
newsList=newsService.getPageNewsList(currPageNo,pageSize); int i=0; for(News news:newsList){ i++; %>
<% PageSupport pageSupport = new PageSupport(); //页面容量 int pageSize = 2; //当前页码 String pageIndex =request.getParameter("pageIndex"); int currPageNo=1; if(pageIndex==null){ currPageNo = 1; }else{ try{ currPageNo = Integer.parseInt(pageIndex); }catch(NumberFormatException e){ response.sendRedirect("error.jsp"); } } pageSupport.setCurrPageNo(currPageNo); //总记录数 int newsCount = newsService.getNewsCount(); //总页数 pageSupport.setPageSize(pageSize); pageSupport.setRecordCount(newsCount); int totlePageCount = pageSupport.getTotalPageCount(); //首页和尾页的异常控制 if(currPageNo<=0){ currPageNo=1; } if(currPageNo>totlePageCount){ currPageNo=totlePageCount; } List
<%if(i%2==0){%>class="admin-list-td-h2"<%} %>>
<% } %>
新闻标题 作者 时间 操作
<%=news.getTitle() %> <%=news.getAuthor()%> <%=news.getCreateDate() %> 修改 删除

 

转载地址:http://lrlii.baihongyu.com/

你可能感兴趣的文章
数据结构与算法7-栈
查看>>
线性数据结构学习笔记
查看>>
Java并发编程 | 一不小心就死锁了,怎么办?
查看>>
(python版)《剑指Offer》JZ01:二维数组中的查找
查看>>
(python版)《剑指Offer》JZ06:旋转数组的最小数字
查看>>
(python版)《剑指Offer》JZ13:调整数组顺序使奇数位于偶数前面
查看>>
(python版)《剑指Offer》JZ28:数组中出现次数超过一半的数字
查看>>
(python版)《剑指Offer》JZ30:连续子数组的最大和
查看>>
(python版)《剑指Offer》JZ32:把数组排成最小的数
查看>>
(python版)《剑指Offer》JZ02:替换空格
查看>>
JSP/Servlet——MVC设计模式
查看>>
使用JSTL
查看>>
Java 8新特性:Stream API
查看>>
管理用户状态——Cookie与Session
查看>>
最受欢迎的前端框架Bootstrap 入门
查看>>
JavaScript编程简介:DOM、AJAX与Chrome调试器
查看>>
通过Maven管理项目依赖
查看>>
通过Spring Boot三分钟创建Spring Web项目
查看>>
Spring的IoC(依赖注入)原理
查看>>
Guava快速入门
查看>>