zoukankan      html  css  js  c++  java
  • 论文爬取(六)

    论文的查询和模糊搜索界面相关代码

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>论文查询</title>
    <link href="favicon.ico" rel="shortcut icon">
    <link rel="stylesheet" href="../static/css/style.css">
    </head>
    <style>
    input[type=text] {
    100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    }
    select{
    100%;
    padding: 16px 20px;
    border: none;
    border-radius: 4px;


    }
    input[type=submit] {
    100%;
    background-color: #4CAF50;
    color: white;
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    }

    input[type=submit]:hover {
    background-color: #45a049;
    }
    input[type=button], input[type=reset] {
    background-color: #FFBB66;
    border: none;
    color: white;
    padding: 16px 32px;
    text-decoration: none;
    margin: 4px 2px;
    cursor: pointer;
    }
    </style>
    <script type="text/javascript" src="../static/js/jquery.min.js"></script>
    <script type="text/javascript">
    var detail_div = 1;
    var realtotal=1;
    function add_div() {
    var str="<table align='center'> <tr><td><select name='lianjie"+detail_div+"'> <option value='AND'>AND</option> <option value='OR'>OR</option> <option value='NOT'>NOT</option>";
    str=str+"</select></td><td><select name='tiaojian"+detail_div+"'><option value='题目'>题目</option><option value='摘要'>摘要</option><option value='关键词'>关键词</option><option value='作者'>作者</option></select></td><td><input type='text' name='input"+detail_div+"'></td><td><select name='jingdu"+detail_div+"'><option value='精准'>精准</option><option value='模糊'>模糊</option><td><input type='button' id='addbtn"+detail_div+"' value='+' onclick='add_div()'></td>";
    str=str+"<td><input type='button' id='delebtn"+detail_div+"' value='-' onclick='dele_div(this)'></td></tr></table>";
    var div = document.createElement("div");
    //div.className = "form-group";
    div.id = "lotdiv" + detail_div;
    div.innerHTML = str;
    document.getElementById("biaodan").appendChild(div);
    detail_div++;
    realtotal++;
    document.getElementById("sum").value=detail_div;
    document.getElementById("realsum").value=realtotal;
    }
    function dele_div(obj){
    var id=obj.id;
    realtotal--;
    id=id.substring(7);
    var e = document.getElementById("lotdiv"+id);
    document.getElementById("biaodan").removeChild(e);
    document.getElementById("sum").value=detail_div;
    document.getElementById("realsum").value=realtotal;
    }
    var findnummm=0;
    var resnum=0;
    var alldata;
    function sendAjax(){

    $.ajax({
    type: "get",
    url: '/c3',
    data: $('#biaodan').serializeArray() ,
    dataType: "json",
    success: function(result){
    alldata=result;
    reslist(result);
    if(findnummm==0){
    addresfinddiv();
    findnummm=1;
    }
    else changeresnum();
    },
    error: function(){
    alert("error");
    }

    });
    }
    function reslist(data){
    var tab=document.getElementById("restable");
    var str="<tr><td width='35%'>标题</td><td width='35%'>作者</td><td width='15%'>时间</td><td width='15%'>链接</td></tr>";
    var i=0;
    for(n in data['title']){
    str=str+"<tr><td>"+data['title'][i]+"</td><td>"+data['zuozhe'][i]+"</td><td>"+data['time'][i]+"</td><td><a target='_blank' href='"+data['lianjie'][i]+"'>"+"点此阅读文章"+"</a></td></tr>";
    resnum=resnum+1;
    i++;
    }
    tab.innerHTML = str;
    }
    function addresfinddiv(){
    var formdiv=document.getElementById("tjdiv");
    var str="<select id='resselect' onchange='changedata()'><option value='选择年份'>选择年份</option><option value='近三年'>近三年</option><option value='近两年'>近两年</option><option value='去年'>去年</option></select>";
    str=str+"<h2 align='center' id='totalnumh'>一共"+resnum+"条</h2>"
    var div = document.createElement("div");
    div.id="changeresdiv";
    div.innerHTML = str;
    formdiv.appendChild(div);
    resnum=0;
    }
    function changeresnum(){
    var formdiv=document.getElementById("tjdiv");
    //document.getElementById("totalnumh").remove();
    document.getElementById("changeresdiv").remove();
    var str="<select id='resselect' onchange='changedata()'><option value='选择年份'>选择年份</option><option value='近三年'>近三年</option><option value='近两年'>近两年</option><option value='去年'>去年</option></select>";
    str=str+"<h2 align='center' id='totalnumh'>一共"+resnum+"条</h2>"
    var div = document.createElement("div");
    div.id="changeresdiv";
    div.innerHTML = str;
    formdiv.appendChild(div);
    resnum=0;
    }
    function changedata(){
    var chdanum=0;
    var vl=document.getElementById("resselect");
    var index = vl.selectedIndex;
    var chva=vl.options[index].value;
    document.getElementById("restable").remove();
    var str="<table id='restable'>"+"<tr><td width='35%'>标题</td><td width='35%'>作者</td><td width='15%'>时间</td><td width='15%'>链接</td></tr>";
    if(chva=="近两年"){
    for(i in alldata){
    if(alldata[i].time.substring(0,4)!="2018"){
    chdanum=chdanum+1;
    str=str+"<tr><td>"+alldata[i].title+"</td><td>"+alldata[i].zuozhe+"</td><td>"+alldata[i].time+"</td><td><a target='_blank' href='"+alldata[i].lianjie+"'>"+"点此阅读文章"+"</a></td></tr>";
    }
    }
    }
    else if(chva=="去年"){
    for(i in alldata){
    if(alldata[i].time.substring(0,4)=="2020"){
    chdanum=chdanum+1;
    str=str+"<tr><td>"+alldata[i].title+"</td><td>"+alldata[i].zuozhe+"</td><td>"+alldata[i].time+"</td><td><a target='_blank' href='"+alldata[i].lianjie+"'>"+"点此阅读文章"+"</a></td></tr>";
    }
    }
    }
    else if(chva=="近三年"){
    for(i in alldata){
    chdanum=chdanum+1;
    str=str+"<tr><td>"+alldata[i].title+"</td><td>"+alldata[i].zuozhe+"</td><td>"+alldata[i].time+"</td><td><a target='_blank' href='"+alldata[i].lianjie+"'>"+"点此阅读文章"+"</a></td></tr>";
    }

    }
    var div=document.getElementById("reslunwendiv");
    div.innerHTML = str+"</table>";
    var formdiv=document.getElementById("tjdiv");
    document.getElementById("changeresdiv").remove();
    var str="<select id='resselect' onchange='changedata()'><option value='选择年份'>选择年份</option><option value='近三年'>近三年</option><option value='近两年'>近两年</option><option value='去年'>去年</option></select>";
    str=str+"<h2 align='center' id='totalnumh'>一共"+chdanum+"条</h2>"
    var div1 = document.createElement("div");
    div1.id="changeresdiv";
    div1.innerHTML = str;
    formdiv.appendChild(div1);
    }
    </script>
    <div >
    <div align="center"><a target='_blank' href="c1">可视化视图</a></div>
    <form action="servlet?method=findlunwen" method="post" id="biaodan" >
    <div align="center" id="firdiv" >
    <table align="center">
    <tr>
    <td><select name="tiaojian" id="tiaojian">
    <option value="题目">题目</option>
    <option value="摘要">摘要</option>
    <option value="关键词">关键词</option>
    <option value="作者">作者</option>
    </select></td>
    <td><input type="text" id="firinput" name="firinput"></td>
    <td><select name="jingzhun" id="jingzhun"><option value="精准">精准</option><option value="模糊">模糊</option></select>
    <td><input type="button" id="firbut" value="+" onclick="add_div()"></td>
    </tr>
    </table>
    </div>
    <input type="hidden" name="sum" id="sum" value="1">
    <input type="hidden" name="realsum" id="realsum" value="1">
    </form>
    <form method="post" id="tjdiv">
    <div align="center"><input type="button" value="查询" onclick="sendAjax()" class="findbtn"></div>
    </form>
    <div align="center" id="reslunwendiv" class="subbox">
    <table id="restable" >

    </table>
    </div>
    </div>
    </body>
    </html>
  • 相关阅读:
    杂题之求1-100连续不重复整数中的缺少的一个数
    C语言之位运算
    程序员的激情其实是一种痛苦
    主机windwo7+虚拟机centos如何配置虚拟机可以上网,且与主机互ping通
    MyEclipse Servers视窗出现“Could not create the view: An unexpected exception was thrown”错误解决办法
    一个web项目在myeclipse中add deployment时无法被识别出来的原因
    Hibernate中,将session绑定到线程时,在保存和查询数据的代码里,要正确的关闭session
    springframwork历史版本下载地址
    在web项目中使用cxf开发webservice,包含spring支持
    [转] Spring Security(01)——初体验
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14912349.html
Copyright © 2011-2022 走看看