Home > Web Front-end > JS Tutorial > JS realizes automatic word reading (youdao word book adding function)

JS realizes automatic word reading (youdao word book adding function)

高洛峰
Release: 2016-12-07 09:34:51
Original
1462 people have browsed it

I am more accustomed to using Youdao. After using it for a while, it is very inconvenient to memorize words. Youdao Word Customer Duan does not have the function of automatic reading. This article uses powerful js to implement a simple automatic next word function,

JS realizes automatic word reading (youdao word book adding function)

Method:

The first step is to open the "Dict6.3.69.8341resultuijswordBook.js" file under Youdao path

Add the following code

//自动下一个代码
var btnStart = document.getElementById('btn');
var textBox = document.getElementById('textBox');
var record=0;
var time = null;
if(btnStart != null) {
btnStart.onclick = function() {
if(btnStart.value == 'Start' && textBox.value != '') {
timer();
btnStart.value = 'Stop';
} else if(btnStart.value == 'Stop') {
clearInterval(time);
btnStart.value = 'Start';
}
}
}
function timer() {
time = setInterval(function() {
var mask = document.getElementById('mask');
var e = document.createEventObject();
if(forget) {
//切换单词
forget.fireEvent("onclick", e);
location.href = forget.href;
mask.fireEvent('onclick', e);
//显示释义区
if(toggle_description) {
description.style.display = "block";
mask.style.display = "none";
if(disable_action) disable_action.style.display = "none";
action.style.display = "block";
};
}
}, textBox.value);
}
Copy after login

The second step is to open "Dict6" under Youdao path .3.69.8341resultuiwbreview.html"File

Add buttons and edit boxes

<!--自定义控件开始-->
<a style="font-size: 12px;" >间隔设置</a>
<input type="text" style="width:50px; " id="textBox" value="1000" />
<input type="button" style=" background-color:#6299c5; border:1px solder #6229c5; color:#fff width:180px; height: 25px; " id="btn" value="Start" />
<!--自定义控件结束-->
Copy after login


Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template