在线小说网站的设计与实现(附源码)

news/2024/5/19 17:20:41/文章来源:https://blog.csdn.net/tiantangdizhibuxiang/article/details/77443417

最近在做一个课程设计,在线小说网站的设计,以下是课题要求,需要项目练手的童鞋可以试试身手。

由于最近新学了JavaEE,所以采用了jsp+servlet来写,前端部分用了少量的js和jQuery处理,数据库用了MySQL,开发平台是myeclipse。

发布文章时直接插入数据库会没有分段,这里的解决办法是引入第三方工具wangEditor(wangEditor 是一款基于JavaScript和css开发的html富文本编辑器,开源免费。产品第一版发布于2014年11月。关于该编辑器:http://www.kancloud.cn/wangfupeng/wangeditor2/113961)


首先数据库的设计结构:

[sql] view plaincopy
print?
  1. /*  
  2. Navicat MySQL Data Transfer  
  3.   
  4. Source Server         : blog  
  5. Source Server Version : 50528  
  6. Source Host           : localhost:3306  
  7. Source Database       : novel  
  8.   
  9. Target Server Type    : MYSQL  
  10. Target Server Version : 50528  
  11. File Encoding         : 65001  
  12.   
  13. Date: 2016-12-31 16:04:07  
  14. */  
  15.   
  16. SET FOREIGN_KEY_CHECKS=0;  
  17.   
  18. -- ----------------------------  
  19. -- Table structure for admin  
  20. -- ----------------------------  
  21. DROP TABLE IF EXISTS `admin`;  
  22. CREATE TABLE `admin` (  
  23.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  24.   `adminName` varchar(255) NOT NULL,  
  25.   `adminPassword` varchar(255) NOT NULL,  
  26.   PRIMARY KEY (`id`)  
  27. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;  
  28.   
  29. -- ----------------------------  
  30. -- Table structure for author  
  31. -- ----------------------------  
  32. DROP TABLE IF EXISTS `author`;  
  33. CREATE TABLE `author` (  
  34.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  35.   `authorName` varchar(255) NOT NULL,  
  36.   `authorPassword` varchar(255) NOT NULL,  
  37.   `authorEmail` varchar(255) DEFAULT NULL,  
  38.   PRIMARY KEY (`id`)  
  39. ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;  
  40.   
  41. -- ----------------------------  
  42. -- Table structure for comment  
  43. -- ----------------------------  
  44. DROP TABLE IF EXISTS `comment`;  
  45. CREATE TABLE `comment` (  
  46.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  47.   `context` text,  
  48.   `createdTime` datetime DEFAULT NULL,  
  49.   `readerName` varchar(255) DEFAULT NULL,  
  50.   `novelId` int(11) DEFAULT NULL,  
  51.   PRIMARY KEY (`id`)  
  52. ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;  
  53.   
  54. -- ----------------------------  
  55. -- Table structure for genre  
  56. -- ----------------------------  
  57. DROP TABLE IF EXISTS `genre`;  
  58. CREATE TABLE `genre` (  
  59.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  60.   `namevarchar(255) DEFAULT NULL,  
  61.   `sort` int(11) DEFAULT NULL,  
  62.   PRIMARY KEY (`id`)  
  63. ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;  
  64.   
  65. -- ----------------------------  
  66. -- Table structure for novel  
  67. -- ----------------------------  
  68. DROP TABLE IF EXISTS `novel`;  
  69. CREATE TABLE `novel` (  
  70.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  71.   `title` varchar(255) NOT NULL,  
  72.   `context` text NOT NULL,  
  73.   `createdTime` datetime DEFAULT NULL,  
  74.   `genreId` int(11) DEFAULT NULL,  
  75.   `voteNumber` int(11) NOT NULL,  
  76.   PRIMARY KEY (`id`)  
  77. ) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=utf8;  
  78.   
  79. -- ----------------------------  
  80. -- Table structure for reader  
  81. -- ----------------------------  
  82. DROP TABLE IF EXISTS `reader`;  
  83. CREATE TABLE `reader` (  
  84.   `id` int(11) NOT NULL AUTO_INCREMENT,  
  85.   `readerName` varchar(255) NOT NULL,  
  86.   `readerPassword` varchar(255) NOT NULL,  
  87.   `readerEmail` varchar(255) DEFAULT NULL,  
  88.   PRIMARY KEY (`id`)  
  89. ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;  

项目的大致结构如图:


由于功能有点多,这里先介绍后台的实现,管理后台和前台互不交涉。

登录界面



后台主页:

1,小说管理


2,作者管理:


3,增加分类


后台其他导航页面基本雷同,这里不做一一介绍。

后台管理员登录处理代码:

[java] view plaincopy
print?
  1. public class Admin {  
  2.     Conn conn=new Conn();  
  3.     /** 
  4.      * 判断登陆用户是否合法 
  5.      * @param adminName 
  6.      * @param adminPassword 
  7.      * @return 
  8.      * @throws SQLException 
  9.      */  
  10.     public boolean isExist(String adminName,String adminPassword)throws SQLException{  
  11.         boolean result=false;  
  12.         AdminInfo ainfo=new AdminInfo();  
  13.         String sql="select * from admin a where adminName='"+adminName+"'and adminPassword='"+adminPassword+"'";  
  14.         System.out.println(sql);  
  15.         ResultSet rs=conn.executeQuery(sql);  
  16.         if(rs.next()){  
  17.             ainfo.setAdminName(rs.getString("adminName"));  
  18.             ainfo.setAdminPassword(rs.getString("adminPassword"));  
  19.             result=true;  
  20.         }  
  21.         conn.close();  
  22.         return result;  
  23.     }  
  24. }  

小说展示,管理,增加,删除,更新的代码处理:

[java] view plaincopy
print?
  1. public class Novel {  
  2.     Conn conn=new Conn();  
  3.     /** 
  4.      * 获取小说列表 
  5.      * @param keyword 
  6.      * @return 
  7.      * @throws SQLException 
  8.      */  
  9.       
  10.     public List<NovelInfo>getList(String keyword)throws SQLException{  
  11.         List<NovelInfo> list=new ArrayList<NovelInfo>();  
  12.   
  13.         String sql="select n.*,g.name as genreName from novel n left join genre g on n.genreId=g.id";  
  14.         if(DataValidator.isNullOrEmpty(keyword)){  
  15.             sql=sql+ " order by id desc";  
  16.         }else{  
  17.             sql=sql+" where n.title like '%"+keyword+"%' order by id desc";  
  18.         }  
  19.         ResultSet rs=conn.executeQuery(sql);  
  20.         while(rs.next()){  
  21.             NovelInfo ninfo=new NovelInfo();  
  22.             ninfo.setId(rs.getInt("Id"));  
  23.             ninfo.setTitle(rs.getString("Title"));  
  24.             ninfo.setContext(rs.getString("Context"));  
  25.             ninfo.setCreatedTime(rs.getDate("CreatedTime"));  
  26.             ninfo.setGenreId(rs.getInt("GenreId"));  
  27.             ninfo.setGenreName(rs.getString("genreName"));  
  28.             ninfo.setVoteNumber(rs.getInt("voteNumber"));  
  29.             list.add(ninfo);  
  30.         }  
  31.         conn.close();  
  32.         return list;  
  33.     }  
  34.     /** 
  35.      * 获取某分类下的小说列表 
  36.      * @param classId 
  37.      * @return 
  38.      * @throws SQLException 
  39.      */  
  40.     public List<NovelInfo> getListBygenreId(int genreId) throws SQLException{  
  41.         List<NovelInfo> list=new ArrayList<NovelInfo>();  
  42.         String sql="select n.*,g.name as genreName from novel n left join genre g on n.genreId=g.id"  
  43.                 + " where n.genreId="+genreId+" order by id desc";  
  44.         ResultSet rs=conn.executeQuery(sql);  
  45.         while(rs.next()){  
  46.             NovelInfo info=new NovelInfo();  
  47.             info.setId(rs.getInt("Id"));  
  48.             info.setTitle(rs.getString("Title"));  
  49.             info.setContext(rs.getString("Context"));  
  50.             info.setCreatedTime(rs.getDate("CreatedTime"));  
  51.             info.setGenreId(rs.getInt("GenreId"));  
  52.             info.setGenreName(rs.getString("genreName"));  
  53.             info.setVoteNumber(rs.getInt("voteNumber"));  
  54.             list.add(info);  
  55.         }  
  56.         conn.close();  
  57.         return list;  
  58.     }  
  59.     /** 
  60.      * 根据ID获取小说 
  61.      * @param id 
  62.      * @return 
  63.      * @throws SQLException 
  64.      */  
  65.     public NovelInfo getNovelInfo(int id) throws SQLException{  
  66.         NovelInfo info=new NovelInfo();  
  67.         String sql="select n.*,g.name as genreName from novel n left join genre g on n.genreId=g.id where n.id="+id+"";  
  68.         ResultSet rs=conn.executeQuery(sql);  
  69.         while(rs.next()){  
  70.             info.setId(rs.getInt("Id"));  
  71.             info.setTitle(rs.getString("Title"));  
  72.             info.setContext(rs.getString("Context"));  
  73.             info.setCreatedTime(rs.getDate("CreatedTime"));  
  74.             info.setGenreId(rs.getInt("GenreId"));  
  75.             info.setGenreName(rs.getString("genreName"));  
  76.             info.setVoteNumber(rs.getInt("voteNumber"));  
  77.         }  
  78.         conn.close();  
  79.         return info;  
  80.     }  
  81.     /** 
  82.      * 写入新小说 
  83.      *  
  84.      * @param info 
  85.      * @return 
  86.      */  
  87.     public int insert(NovelInfo info){  
  88.         String sql="insert into novel(title,conText,createdTime,genreId,voteNumber)values";  
  89.         sql=sql+"('"+info.getTitle()+"','"+info.getContext()+"',now(),'"+info.getGenreId()+"',"+info.getVoteNumber()+")";  
  90.         int result=0;  
  91.         System.out.println(sql);  
  92.         result=conn.executeUpdate(sql);  
  93.         conn.close();  
  94.         return result;  
  95.     }  
  96.   
  97.     /** 
  98.      *更新小说 
  99.      * @param info 
  100.      * @return 
  101.      */  
  102.     public int update(NovelInfo info){  
  103.         String sql="update novel set "+" Title='"+info.getTitle()+"',Context='"+info.getContext()+"',"  
  104.                 + "genreId='"+info.getGenreId()+"'where id="+info.getId()+"";  
  105.         int result=0;  
  106.         System.out.println(sql);  
  107.         result=conn.executeUpdate(sql);  
  108.         conn.close();  
  109.         return result;  
  110.     }  
  111.     /** 
  112.      * 删除小说 
  113.      * @param id 
  114.      * @return 
  115.      */  
  116.       
  117.     public int delete(int id){  
  118.         String sql="delete from novel where id="+id+"";  
  119.         int result=0;  
  120.         result=conn.executeUpdate(sql);  
  121.         conn.close();  
  122.         return result;  
  123.     }  
  124.     /** 
  125.      * 增加票数 
  126.      * @return 
  127.      */  
  128.     public int addVote(int num){  
  129.           
  130.         return 0;  
  131.           
  132.     }  
  133. }  

小说评论展示,管理,增加,删除,更新的代码处理:

[java] view plaincopy
print?
  1. public class Comment {  
  2.     Conn conn=new Conn();  
  3.     /** 
  4.      * 获取评论列表 
  5.      * @return 
  6.      * @throws SQLException 
  7.      */  
  8.     public List<CommentInfo> getList() throws SQLException{  
  9.         List<CommentInfo> list=new ArrayList<CommentInfo>();  
  10.         String sql="select * from comment order by id desc";  
  11.         ResultSet rs=conn.executeQuery(sql);  
  12.         while(rs.next()){  
  13.             CommentInfo info=new CommentInfo();  
  14.             info.setId(rs.getInt("Id"));  
  15.             info.setContext(rs.getString("Context"));  
  16.             info.setNovelId(rs.getInt("NovelId"));  
  17.             info.setCreatedTime(rs.getDate("CreatedTime"));  
  18.             info.setReaderName(rs.getString("ReaderName"));  
  19.             list.add(info);  
  20.             System.out.print(list);  
  21.         }  
  22.         conn.close();  
  23.         return list;  
  24.     }  
  25.     /** 
  26.      *  
  27.      * @param classId 
  28.      * @return 
  29.      * @throws SQLException 
  30.      */  
  31.     public CommentInfo getCommentInfo(int id)throws SQLException{  
  32.         CommentInfo info=new CommentInfo();  
  33.         String sql="select * from Comment c where id="+id+"";  
  34.         ResultSet rs=conn.executeQuery(sql);  
  35.         while(rs.next()){  
  36.             info.setId(rs.getInt("Id"));  
  37.             info.setContext(rs.getString("Context"));  
  38.             info.setNovelId(rs.getInt("NovelId"));  
  39.             info.setCreatedTime(rs.getDate("CreatedTime"));  
  40.             info.setReaderName(rs.getString("ReaderName"));  
  41.         }  
  42.         conn.close();  
  43.         return info;  
  44.           
  45.     }  
  46.     /** 
  47.      *  获取某小说下的评论 
  48.      * @param id 
  49.      * @return 
  50.      * @throws SQLException 
  51.      */  
  52.     public List<CommentInfo> getListByNovelId(int novelid) throws SQLException{  
  53.         List<CommentInfo> list=new ArrayList<CommentInfo>();  
  54.         String sql="select * from comment  where novelId="+novelid+" order by id desc";  
  55.         ResultSet rs=conn.executeQuery(sql);  
  56.         while(rs.next()){  
  57.             CommentInfo info=new CommentInfo();  
  58.             info.setId(rs.getInt("Id"));  
  59.             info.setContext(rs.getString("Context"));  
  60.             info.setNovelId(rs.getInt("NovelId"));  
  61.             info.setCreatedTime(rs.getDate("CreatedTime"));  
  62.             info.setReaderName(rs.getString("ReaderName"));  
  63.             list.add(info);  
  64.         }  
  65.         conn.close();  
  66.         return list;  
  67.     }  
  68.     /** 
  69.      * 插入评论 
  70.      * @param info 
  71.      * @return 
  72.      */  
  73.     public int insert(CommentInfo info){  
  74.         String sql="insert into Comment(Context,CreatedTime,readerName,novelId)values";  
  75.         sql=sql+"('"+info.getContext()+"',now(),'"+info.getReaderName()+"',"+info.getNovelId()+")";  
  76.         int result=0;  
  77.         System.out.println(sql);  
  78.         result=conn.executeUpdate(sql);  
  79.         conn.close();  
  80.         return result;  
  81.     }  
  82.     /** 
  83.      * 更新评论 
  84.      * @param info 
  85.      * @return 
  86.      */  
  87.     public int update(CommentInfo info){  
  88.         String sql="update Comment set "+" Context='"+info.getContext()+"',novelId='"+info.getNovelId()+"',"  
  89.                 + "CreatedTime='"+info.getCreatedTime()+"',readerName='"+info.getReaderName()+"' where id="+info.getId()+"";  
  90.         int result=0;  
  91.         System.out.println(sql);  
  92.         result=conn.executeUpdate(sql);  
  93.         conn.close();  
  94.         return result;  
  95.     }  
  96.     /** 
  97.      * 删除评论 
  98.      * @param id 
  99.      * @return 
  100.      */  
  101.     public int delete(int id){  
  102.         String sql="delete from Comment where id="+id+"";  
  103.         int result=0;  
  104.         result=conn.executeUpdate(sql);  
  105.         System.out.println(sql);  
  106.         conn.close();  
  107.         return result;  
  108.     }  
  109. }  


小说分类展示,更新,增加,删除的代码处理:


[java] view plaincopy
print?
  1. public class Genre {  
  2.     Conn conn=new Conn();  
  3.     /** 
  4.      * 获取分类列表 
  5.      * @return 
  6.      * @throws SQLException 
  7.      */  
  8.     public List<GenreInfo> getList()throws SQLException{  
  9.         List<GenreInfo> list=new ArrayList<GenreInfo>();  
  10.         String sql="select * from genre order by Sort asc";  
  11.         ResultSet rs=conn.executeQuery(sql);  
  12.         while(rs.next()){  
  13.             GenreInfo info=new GenreInfo();  
  14.             info.setId(rs.getInt("Id"));  
  15.             info.setName(rs.getString("Name"));  
  16.             info.setSort(rs.getInt("Sort"));  
  17.             list.add(info);  
  18.     }  
  19.         conn.close();  
  20.         return list;  
  21.     }  
  22.     /** 
  23.      *  
  24.      * @param id 
  25.      * @return 
  26.      * @throws SQLException 
  27.      */  
  28.     public GenreInfo getGenreInfo(int id)throws SQLException{  
  29.         GenreInfo info=new GenreInfo();  
  30.         String sql="select * from genre g where id="+id+"";  
  31.         ResultSet rs=conn.executeQuery(sql);  
  32.         while(rs.next()){  
  33.             info.setId(rs.getInt("Id"));  
  34.             info.setName(rs.getString("Name"));  
  35.             info.setSort(rs.getInt("Sort"));  
  36.     }  
  37.         conn.close();  
  38.         return info;  
  39.     }  
  40.     /** 
  41.      * 增加分类 
  42.      * @param info 
  43.      * @return 
  44.      */  
  45.     public int insert(GenreInfo info){  
  46.         String sql="insert into genre(Name,Sort) values";  
  47.         sql=sql+"('"+info.getName()+"','"+info.getSort()+"')";  
  48.         int result=0;  
  49.         result=conn.executeUpdate(sql);  
  50.         conn.close();  
  51.         return result;  
  52.     }  
  53.     /** 
  54.      * 更新分类 
  55.      *  
  56.      * @param info 
  57.      * @return 
  58.      */  
  59.     public int update(GenreInfo info){  
  60.         String sql="update genre set "+" Name='"+info.getName()+"',Sort= '"+info.getSort()+"' where id="+info.getId()+"";  
  61.         int result=0;  
  62.         result=conn.executeUpdate(sql);  
  63.         return result;  
  64.           
  65.     }  
  66.     public int delete(int id){  
  67.         String sql="delete from genre where id="+id+"";  
  68.         int result=0;  
  69.         result=conn.executeUpdate(sql);  
  70.         conn.close();  
  71.         return result;  
  72.     }  
  73.       
  74. }  

前台主要页面展示:(略丑)


作者发布小说界面:


读者评论界面:


为小说投票,投票功能的前端设计代码:

[javascript] view plaincopy
print?
  1. function getElemensByClassName(className){  // 通过class获取  
  2.   var classArr = new Array();  
  3.   var tags = document.getElementsByTagName("*"); //获取所有节点  
  4.   for(var item in tags){   
  5.     if(tags[item].nodeType == 1){   
  6.     if(tags[item].getAttribute("class") == className){   
  7.       classArr.push(tags[item]); //收集class匹配的节点  
  8.     }  
  9.   }  
  10. }  
  11.   return classArr;  
  12. }  
  13.    
  14. function delete_FF(element){  // 在FireFox中删除子节点为空的元素  
  15.   var childs = element.childNodes;  
  16.   for(var i=0;i<childs.length;i++){   
  17.     var pattern = /\s/; //模式匹配,内容为空  
  18.     if(childs[i].nodeName == "#text" && pattern.test(childs[i].nodeValue)){  //处理  
  19.       //alert(childs[i].nodeName);  
  20.       element.removeChild(childs[i]); //删除FF中获取的空节点  
  21.     }  
  22.   }  
  23. }  
  24. function $(obj){return document.getElementById(obj);}  
  25. window.onload = function(){   
  26.     onload1();  
  27.     onload2();  
  28. };  
  29. function onload2(){  
  30.   var persons = getElemensByClassName("person");  
  31. //  alert(persons);  
  32.   for(var item in persons){  //遍历所有person,为它们绑定投票事件  
  33.     (function(_item){    //匿名函数传入item, 防止因作用域问题导致item总为最后一个  
  34.     delete_FF(persons[_item]); //出去FF中空行代表的子节点  
  35.     persons[_item].setAttribute("id","person"+(parseInt(_item)+1)); //赋上id  
  36.    
  37.     var childs = persons[_item].childNodes;  
  38.     for(var i = 0;i<childs.length;i++){   
  39.       //alert(childs[i].nodeName);  
  40.       if(childs[i].nodeName == "BUTTON"){  //点击按钮投票  
  41.         var oButton = childs[i];  
  42.       }  
  43.       if(childs[i].nodeName == "P"){  //投票结果更新  
  44.         var oP = childs[i];  
  45.         var oSpan = oP.getElementsByTagName("span")[0];  
  46.       }  
  47.     }  
  48.     if(oButton != null){  
  49.     oButton.onclick = function(){  //事件绑定  
  50.       var num = oSpan.innerHTML; //获取票数  
  51.       oSpan.innerHTML = (++num); //票数更新  
  52.                     // 这时一般我们可能就需要把这个票数num传送给服务器保存,更新时也是和服务器中的num同步  
  53.       this.setAttribute("disabled","true"); // 一般只能投票一次的吧  
  54.       alert("投票成功,谢谢您的支持");  
  55.     };  
  56.   }  
  57. })(item); // 传入各项person  
  58.   }  
  59. }  

小说发布的实现细节,引入了wangEditor:

[plain] view plaincopy
print?
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
  2. <%@page import="org.common.*" %>  
  3. <%@page import="org.model.*" %>  
  4. <%@page import="org.dal.*" %>  
  5. <%  
  6. String path = request.getContextPath();  
  7. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
  8. %>  
  9. <!-- 发布小说 -->  
  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
  11. <html>  
  12.   <head>  
  13.     <base href="<%=basePath%>">  
  14.     <title>小说编辑发布界面</title>  
  15.     <script type="text/javascript" src="js/jquery-1.10.1.js"></script>  
  16.     <link rel="stylesheet" type="text/css" href="css/edit.css">  
  17.     <link rel="stylesheet" type="text/css" href="css/wangEditor.min.css">  
  18.     <script type="text/javascript" src="js/wangEditor.min.js"></script>  
  19.   </head>  
  20.    
  21.   <body>  
  22. <%   
  23.     request.setCharacterEncoding("utf-8");  
  24.     Genre cls=new Genre();  
  25.     List<GenreInfo>list=cls.getList();  
  26.     Novel novel=new Novel();  
  27.     NovelInfo ninfo=new NovelInfo();  
  28.     if("fabu".equals(request.getParameter("action")))  
  29. {     
  30.     ninfo.setTitle(request.getParameter("txtTitle"));  
  31.     ninfo.setContext(request.getParameter("content"));  
  32.     ninfo.setGenreId(DataConverter.toInt(request.getParameter("selClass")));  
  33.     novel.insert(ninfo);  
  34.     out.println("<script>alert('发布成功');</script>");  
  35. }  
  36. %>     
  37. <div class="header">    
  38.     <h2>当前位置:小说编辑</h2>  
  39. </div>  
  40.   <a class="wel">欢迎您:<%=Utilty.readCookie(request, "user")%></a>  
  41.   <div class="context" >  
  42.     <form id="form1" name="form1" method="post"   
  43.     action="novel/novel-edit.jsp?action=fabu" οnsubmit="return check(this)">  
  44.         <table>  
  45.             <tr>  
  46.             <td>小说所属分类:</td>  
  47.             <td>  
  48.             <select name="selClass" id="selClass" style="width:300px;height:30px;">  
  49.                 <%  
  50.                     for(GenreInfo cinfo:list){  
  51.                 %>  
  52.                 <option value="<%=cinfo.getId() %>">  
  53.                 <%if(cinfo.getId()==ninfo.getId()) %>  
  54.                 <%=cinfo.getName() %></option>  
  55.                 <%  
  56.                     }  
  57.                 %>  
  58.             </select>  
  59.             </td>  
  60.             </tr>  
  61.             <tr>  
  62.             <td>小  说   标   题:</td>  
  63.             <td><input type="text" name="txtTitle" id="txtTitle" style="width:500px;height:30px"/></td>  
  64.             </tr>  
  65.               
  66.             <tr>  
  67.                 <td>小  说   内   容:</td>  
  68.                  <td style="width:1000px;"><textarea rows="25" name="content" id="content"></textarea> </td>  
  69.             </tr>  
  70.               
  71.     <tr>  
  72.     <td colspan="2" class="inp">  
  73.         <input class="submit" type="submit" name="button" id="button" value="提交" style="color:#FFFFFF"/>  
  74.         <input class="submit" type="reset" name="button2" id="button2" value="重置"style="color:#FFFFFF" />  
  75.     </td>  
  76.     </tr>  
  77.         </table>  
  78.     </form>  
  79.     </div>  
  80.   </body>  
  81.     <script type="text/javascript">  
  82.         var editor = new wangEditor('content');  
  83.         editor.config.menus = [  
  84.                     'bold',  
  85.                     'underline',  
  86.                     'italic',  
  87.                     'strikethrough',  
  88.                     'eraser',  
  89.                     'forecolor',  
  90.                     'bgcolor',  
  91.                     '|',  
  92.                     'link',  
  93.                     'unlink',  
  94.                     'table',  
  95.                     'emotion',  
  96.                     '|',  
  97.                     'img',  
  98.                     'video',  
  99.                     'location',  
  100.                          ];  
  101.            
  102.         editor.create();  
  103.     </script>  
  104. </html>  
  好吧,由于代码段较多,这里不能一一介绍,后续直接介绍一下这个项目开发过程中的错误细节,完善之后把源码上传到资源那里,这个项目实现起来较简单,童鞋们可以根据设计要求试试身手哦!

源码地址:http://download.csdn.net/detail/weixin_36380516/9728880

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_851569.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

最新LAMP×××网站平台PHP5.5.1 + Apache2.4.6 + mysql5.6.12

记录一下&#xff0c;今天配置的这台网站服务器&#xff0c;大部分都是在官方找的最新版源码包。1.下载安装所需要的最新软件源码包&#xff0c;包括最新的apache、mysql、php以及相关库文件的源码包。httpd-2.4.6.tar.gz&#xff1a;http://mirrors.cnnic.cn/apache//httpd/ht…

淘宝网采用什么技术架构来实现网站高负载分析

2019独角兽企业重金招聘Python工程师标准>>> (中国电子商务研究中心讯)时间过得很快&#xff0c;来淘宝已经两个月了&#xff0c;在这两个月的时间里&#xff0c;自己也感受颇深。下面就结合淘宝目前的一些底层技术框架以及自己的一些感触来说说如何构建一个可伸缩&…

另类解决 无法在发生错误时创建会话,请检查 PHP 或网站服务器日志,并正确配置 PHP 安装

安装了PHPStudy,在登录PHPMyAdmin时&#xff0c;出现“无法在发生错误时创建会话&#xff0c;请检查 PHP 或网站服务器日志&#xff0c;并正确配置 PHP 安装”的提示&#xff0c;而无法进入数据库的问题。 在试过了N多网上的解决办法之后&#xff0c;终于觉醒&#xff0c;网的…

ASP.NET MVC5 网站开发实践(二) Member区域 - 咨询管理的架构

咨询、留言、投诉等功能是网站应具备的基本功能&#xff0c;可以加强管理员与用户的交流&#xff0c;在上次完成文章部分后&#xff0c;这次开始做Member区域的咨询功能&#xff08;留言、投诉都是咨询&#xff09;。咨询跟文章非常相似&#xff0c;而且内容更少、更简单。 目录…

onmouseout,mouseover经过子元素也触发的问题解决方案

在mouseout与mouseover的冒泡问题上&#xff0c;相信有很多朋友都遇到过。今天这里就总结一下 关于mouseover和mouseout冒泡问题的解决方案&#xff1a; 首先&#xff0c;看下event.relatedTarget的用法。 relatedTarget 事件属性返回与事件的目标节点相关的节点。 relate…

25个精美的创意机构和设计工作室网站案例

浏览器创意机构和设计工作室为他们自己设计的网站是一件非常有趣的事情。这些人设计的网站&#xff0c;代表着整个领域的最新趋势&#xff0c;值得网页设计人员去跟随。 有人可能会认为他们会用最疯狂&#xff0c;过于超前的设计。但你会惊讶地知道&#xff0c;这些创意机构和设…

个人网站盈利的几种方式

之前看到一篇讲述个人网站盈利的10种方法的文章&#xff0c;原文在这里&#xff1a;http://www.sitepoint.com/10-ways-earn-money-from-your-site/ &#xff0c;但不太适合中国国情&#xff0c;不够接地气。本文就说几个接地气的个人网站盈利的几种方法。(主要针对IT个人网站)…

大型网站系统架构演化之路

大型网站系统架构演化之路 前言 一个成熟的大型网站&#xff08;如淘宝、天猫、腾讯等&#xff09;的系统架构并不是一开始设计时就具备完整的高性能、高可用、高伸缩等特性的&#xff0c;它是随着用户量的增加&#xff0c;业务功能的扩展逐渐演变完善的&#xff0c;在这个过程…

微网站|h5弹窗|手机网站 html5 弹窗、弹层、提示框、加载条

为了精确体验&#xff0c;您可通过Chrome设备模式浏览。或通过[url]手机扫二维码进入[/url] layer mobile是为移动设备&#xff08;手机、平板等webkit内核浏览器/webview&#xff09;量身定做的弹层支撑&#xff0c;采用Native JavaScript编写&#xff0c;完全独立于PC版的lay…

访问jira网站中已解决问题链接时跳转到另一IP的解决办法

迁移完Jira后&#xff0c;以普通用户进入jira&#xff0c;点击Jira中已解决问题的链接&#xff0c;发现跳转到的IP是迁移前的IP&#xff0c;以下为解决办法。 第一步&#xff1a;使用管理员用户进入Jira&#xff0c;点击“管理”-->"通用设置"&#xff1b; 第二步…

Wordpress 网站搭建及性能监控方法详解!

2019独角兽企业重金招聘Python工程师标准>>> ######前言 说到 Wordpress&#xff0c;大家往往想到的是博客&#xff0c;其实&#xff0c;如今的 WordPress 已经成为全球使用量最多的开源 CMS 系统。并且&#xff0c;如果你有一定的技术基础稍加改动&#xff0c;就可…

IIS 7 发布网站

1.先按F6编译通过。 2.操作如下列图上所示&#xff1a; 3. IIS 的配置 部署完毕 如有问题请留言&#xff0c;大家一起解决。

支付宝手机网站支付接口API之C#版

一、准备工作 1、使用企业支付宝签约手机网站支付 2、下载支付宝官方demo 文档地址&#xff1a;https://doc.open.alipay.com/doc2/detail?treeId60&articleId103564&docType1 下载地址&#xff1a;http://aopsdkdownload.cn-hangzhou.alipay-pub.aliyun-inc.com/demo…

JQuery仿购物网站放大镜特效所遇问题及思考

JQuery仿购物网站放大镜特效所遇问题及思考 先贴下效果图&#xff0c;然后描述起来也就不会不知道我在说什么了。 我碰到的问题一: 一开始我自己总结了是因为两个小原因导致的①使用了mouseover,mouseout事件②因为层叠样式&#xff08;z-index&#xff09;的原因。一开始的HTM…

bind、click、mouseover、mouseout及简写实现显示与隐藏效果

1、$().bind("click", function() {...........});也可以写成 $().click(function() {..........}); 2、$().bind("mouseover", function() {...........}) .bind("mouseout", function() {...........}); 也可以写成 $().mouseover(function…

如何修改XAMPP默认网站目录

XAMPP默认网站目录保存在...\xampp\htdocs文件夹下&#xff0c;修改目录步骤&#xff1a; 1.XAMPP面板&#xff0c;点击Apache服务器Config按钮&#xff0c;选择Apache&#xff08;httpd.conf&#xff09;&#xff1b; 2.在打开的记事本中&#xff0c;使用快捷键CtrlF进行查找&…

nodejs微信公众号开发——9.爬取网站素材定时推送消息

上一篇文章&#xff1a;nodejs微信公众号开发——8.群发消息&#xff0c;介绍了高级群发接口的实现&#xff0c;并通过一个简单例子加以说明。本节的内容可能和微信公众号开发本身关系不大&#xff0c;只是我小项目中涉及到的内容&#xff0c;知识点包含nodejs爬虫和定时模块。…

jQuery-鼠标事件及使用unbind移除mouseover、mouseout、mousemove绑定

$item.mouseover(function(){//鼠标滑入... }).mouseout(function(){//鼠标滑出... }).mousemove(function(){//鼠标移动... }); 如上&#xff0c;对dom绑定了鼠标事件&#xff0c;那么如何解除绑定呢&#xff1f;如下设置即可&#xff1a; $item.unbind(mouseover).unbind(m…

阿里云ECS建网站(建站)超详细全套完整图文教程!菜鸟必看!

第一步&#xff1a;如何以最低价格快速买到阿里云服务器&#xff1f; 1.1 如果我是学生&#xff0c;我如何通过&#xffe5;9.9买到价值&#xffe5;117的服务&#xff1f; 答&#xff1a;用&#xffe5;9.9购买云服务器ECS是阿里云学生专属活动。首先&#xff0c;你需要在阿里…

云服务器更换PHP版本升级的问题_升级PHP后_网站打不开

摘要&#xff1a; 升级PHP版本后网站打不开解决办法&#xff0c;切换PHP版本后网站打不开解决办法。 文章前面说一下&#xff0c;本人是小白&#xff0c;写这篇文章是因为自己解决了问题&#xff0c;高兴之余&#xff0c;是因为没有这样的文章写出来&#xff0c;可能是太基础的…