一、倒计时

<!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>

二、获取文字

<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" > 确认过眼神 我遇上对的人<br /> 我策马出征 马蹄声如泪奔<br /> 青石板上的月光照进这山城<br /> 我一路的跟 你轮回声 我对你用情极深<br /> 洛阳城旁的老树根<br /> 像回忆般延伸你问<br /> 经过是谁的心跳声<br /> 我拿醇酒一坛饮恨<br /> 你那千年眼神是我<br /> 醉醉坠入赤壁的 伤痕<br /> 确认过眼神 我遇上对的人<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>

但是无法获取 网页中 pdf 的文字内容

javaScript 实现倒计时 + 获取网页中的文字的更多相关文章

  1. javascript高德地图放到网页中的方法

    javascript高德地图放到网页中的方法 1 先获取到经纬度http://lbs.amap.com/console/show/picker 2 下面代码直接设置下中心点 和标记点就可以了 < ...

  2. php获取网页中图片并保存到本地

    php获取网页中图片并保存到本地的代码,将网页中图片保存本地文件夹: save_img("http://www.jbxue.com" ?>

  3. javascript和swf在网页中交互的一些总结

    Javascript和swf在网页中交互一般可有以下几种情况: 1.swf和这些调用的javascript在同域 2.swf和这些调用的javascript在不同域,比如加载远程的swf然后call别 ...

  4. php获取网页中图片并保存到本地的代码

    php获取网页中图片并保存到本地的代码,将网页中图片保存本地文件夹: <?php /** * 获取网页中图片,并保存至本地 * by www.jbxue.com */ header(" ...

  5. 使用jquery获取网页中图片的高度——解惑

    jQuery获取网页中图片的高度 使用jquery获取网页中图片的高度其实很简单,有两种常用的方法都可以打到我们的目的 $("img").whith();(返回纯数字) $(&qu ...

  6. 使用selenium的方式获取网页中图片的链接和网页的链接,来判断是否是死链(二)

    上一篇使用Java正则表达式来判断和获取图片的链接以及跳转的网址,这篇使用selenium的自带的API(getAttribute)来获取网页中指定的内容 实现内容:获取下面所有图片的链接地址以及跳转 ...

  7. 如何将 JavaScript 代码添加到网页中,以及 <script> 标签的属性

    Hello, world! 本教程的这一部分内容是关于 JavaScript 语言本身的. 但是,我们需要一个工作环境来运行我们的脚本,由于本教程是在线的,所以浏览器是一个不错的选择.我们会尽可能少地 ...

  8. IOS遍历网页获取网页中<img>标签中的图片url

    前言: 项目中遇见一个需求遍历网页中所有的<img>标签并且去处图片的url 第一步:编写获取<img >标签的正则表达式,代码如下: -(NSArray*)getImgTag ...

  9. 正则表达式相关:C# 抓取网页类(获取网页中所有信息)

    类的代码: using System; using System.Data; using System.Configuration; using System.Net; using System.IO ...

随机推荐

  1. 为了保护dll这么做吗?

    生成dll时候 附带生成的lib文件

  2. SELinux 对nginx访问目录的影响

    centos新装的系统,用yum 安装的nginx . 因用yum 安装的nginx 默认目录在/usr下面. 当SELinux开启时,将会禁止访问设置在其他路径下的地址.比如我设置server 中 ...

  3. 使用vue写扫雷游戏

    上班闲来没事做,,心血来潮.想用刚学的vue,写一个扫雷游戏..好了,直入正题. 第一步,先制作一个10x10的格子图..这个divcss就不说了..大家都会. 第二步,制造一个数组,用来生成随机雷区 ...

  4. spring cache 几个注解解释

    转自https://www.cnblogs.com/fashflying/p/6908028.html 从3.1开始,Spring引入了对Cache的支持.其使用方法和原理都类似于Spring对事务管 ...

  5. 处理并解决mysql8.0 caching-sha2-password问题,开启远程访问

    原文:https://blog.csdn.net/u010026255/article/details/80062153 启动mysql服务:service mysqld start ALTER US ...

  6. 学到了林海峰,武沛齐讲的Day51 django+数据库

    连不上,通过这一步解决 搞死了..辛苦但觉得值得 刷数据库 出问题 IDEA关联MySQL报错:Server returns invalid timezone. Go to ‘Advanced’ ta ...

  7. linux运维、架构之路-K8s健康检查Health Check

    一.Health Check介绍         强大的自愈能力是k8s容器编排引擎一个重要特性,自愈能力的默认实现方式为自动重启发生故障的容器,另外还可以利用Liveness和Readiness探测 ...

  8. jdk,jre下载安装

    JDK安装https://blog.csdn.net/u012934325/article/details/73441617/jre需要手动生成在JDK安装目录下,的bin cmd执行bin\ jli ...

  9. luogu 2993 [FJOI2014]最短路径树问题 Dijkstra+点分治

    挺简单的,但是给人一种把两个问题强行弄到一起的感觉. 十分不好写. Code: #include <queue> #include <cstdio> #include < ...

  10. python3.6+Xadmin2.0系列(一) xadmin下载及安装

    环境配置:win7+python3.6+Django2.1+xadmin2+PyCharm 一.Xadmin下载及安装: 1.下载: 下载地址:https://github.com/sshwsfc/x ...