Countdown + javaScript achieve acquired web page text

A countdown

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>
<body>
    <p id="demo"></p>
    <script>
        // Set the date we're counting down to
            var countDownDate = new Date("Feb 1 2100 21:23").getTime();

            // Update the count down every 1 second
            var x = setInterval(function() {

                // Get todays date and time
                var now = new Date().getTime();
                
                // Find the distance between now an the count down date
                var distance = countDownDate - now;
                
                // Time calculations for days, hours, minutes and seconds
                var days = Math.floor(distance / (1000 * 60 * 60 * 24));
                var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
                var seconds = Math.floor((distance % (1000 * 60)) / 1000);
                
                // Output the result in an element with id="demo"
                document.getElementById("demo").innerHTML = days + "" + hours + " 小时 "
                + minutes + " 分钟 " + seconds + "";
                
                // If the count down is over, write some text 
                if (distance < 0) {
                    clearInterval(x);
                    document.getElementById("demo").innerHTML = "EXPIRED";
                }
            }, 1000);
    </script>
</body>
</html>

 

 

Second, capturing text

<html>
<head>
<meta charset="UTF-8">
<title>OCR</title>

<style>
*{
    padding:0;
    margin:0;
}

.ddd{
    display:block;
    width:15%;
    height:400px;
    background-color:red;
    margin-left: 82% ; 
    margin-Top : -45% ; 
} 
</ style > 
</ head > 
< body > 

< div ID = "XXX"  > 

    confirmed I met the eyes of the person < br /> 

    I off horse hoof sound as tears ran < br /> 

    moonlight on quartzite shines into this mountain < br /> 

    I cycle all the way to the sound of my soul deep for you and your < br /> 

    old roots next to the city of Luoyang < br /> 

    like memories as an extension of your Q < br /> 

    after whose heartbeat <br /> 

    I get a jar of wine lost by < br /> 

    you are my eyes that Millennium < br /> 

    Drunk Drunk scars fall in Chibi < br /> 

    confirmed my eyes met the right person < br /> 

</ div > 

        < INPUT type = "text" ID = "in"  /> 


< Script > 
    var oContent = document.getElementById ( ' XXX ' ); 
    oContent.onmouseup =  function () {
         var XX = selectText ();
        if(xx == ""){
        }else{
            document.getElementById('in').value = xx;
        }
    };  

    function selectText(){
        if(document.Selection){       
            //ie浏览器
            return document.selection.createRange().text;          
        }else{    
            //标准浏览器
            return window.getSelection().toString();     
        }     
    }

</script>

</body>
</html>

 But can not get the text content of the page in pdf

Guess you like

Origin www.cnblogs.com/expedition/p/11408927.html