• 基于web端去除空格小工具


    读论文时,不时需要抓取PDF版的段落,可是复制到word的时候会出现很多空格,利用javascript强大的功能,几行命令实现了去除段落里的空格,实现如下:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>地理位置坐标转换</title>
         <style media="screen">
            body
            {
                margin: 0;
                padding: 0;
                font-size: 9pt;
                line-height: 1.5em;
            }
            #frame
            {
                width: 1200px;
                margin: 20px auto 10px;
            }
            #searchMap
            {
                margin: 0 0 10px;
                text-align: center;
            }
            
            # button
            {
                font-size: 9pt;
                border: 1px solid #ccc;
            }
    
           
            #txtRight,#txtLeft{
                float: left;
            }
            #result{
                margin-left: 200px;
                height: 200px;
            }
            #searchMap button:hover
            {
                background: #eef;
            }
            #vifix
            {
                text-align: center;
            }
            #vifix a
            {
                color: #f00;
                text-decoration: none;
            }
            #vifix a:hover
            {
                color: #f96;
            }
        </style>
        <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAe3YR_oZq7RQougOHlEQYxRTrT8HRiYVHGz6s-cexYhuHznMTnBQJ3hrfCSvSmQ_Fqr80B62kDy8djA&sensor=true"
            type="text/javascript"></script>
        <script type="text/javascript">
    
            window.g = {};
            window.$ = function (id) { return document.getElementById(id) };
            window.onload=function(){
                function removeAllSpace(str) {
                return str.replace(/s+/g, "");
                }   
                function trim(str) {
                    return str.replace(/(^s+)|(s+$)/g, "");   
                    }
    
                $("btn_go").onclick = function () {
                    $("info").innerHTML="";
                    $("txtResult").value="";
                             
                    var strSearch=$("txtSearch").value;
                        
                    for(var i=0;i<strSearch.length;i++){
                         $("txtResult").value=removeAllSpace(strSearch);
                        }
                    }    
            } 
            window.onunload = function () {
                GUnload();
            }
        </script>
       
    </head>
    <body>
        <div id="frame">
           
            <div id="searchMap">
    
                <p>输入查询的点(用回车分开)</p><button id="btn_go">获取坐标</button><br/>
                <textarea id="txtSearch" rows="20" cols="40"/>
    
                    </textarea>
    
              
                <div id="info">
                </div>
                <div id="result">
                <p>查询结果:</p>
               
                    <div id="txtRight"><textarea id="txtResult" rows="10" cols="70" value="" /></textarea></div>
                <div id="unfound">
                </div>
                </div>
            </div>
    
            <div id="map">
            </div>
            <div id="vifix">
                Powered by <a href="http://code.google.com/apis/maps/" target="_blank">Google Map API</a>
                / Created by <a href="http://vifix.cn%22%3evifix.cn%3c/a>
            </div>
        </div>
    </body>
    </html>
  • 相关阅读:
    tomcat的安装及配置
    java动态代理的实现
    mySql单列索引与联合索引的区别
    maven3.5.0在win10中的安装及环境变量配置
    jQuery相关知识总结
    前端-css
    前段篇:HTML
    Mysql基础安装,初视篇
    论事件驱动与异步IO
    python 之协程
  • 原文地址:https://www.cnblogs.com/sansan/p/3596564.html
Copyright © 2020-2023  润新知