Home  >  Article  >  Web Front-end  >  Pure JavaScript code to implement text comparison tool_javascript skills

Pure JavaScript code to implement text comparison tool_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:15:161629browse

Previous project requirements required writing a pure JS text comparison tool. Here I will share the code on the Script Home platform for your reference. The algorithm needs to be optimized. Please forgive me for the poor writing of this article.

First the renderings:

The code is as follows:

Save the source code as a file in html format and run it directly

<!doctype html>
<html>
<head>
<title>文本比较工具</title>
<style type="text/css">
*{padding:px;margin:px;}
html,body{
overflow-y: hidden;
}
.edit_div{
border: px solid #CCCCCC;
overflow: auto;
position: relative;
}
.edit_div textarea{
resize:none;
background: none repeat scroll transparent;
border: none;
width: %;
height:px;
overflow-y: scroll;
position: absolute;
left: px;
top: px;
z-index: ;
font-size: px;
white-space: pre-wrap;
word-wrap: break-word;
word-break:break-all;
}
.edit_div pre{ 
overflow-y: scroll;
white-space: pre-wrap;
word-wrap: break-word;
word-break:break-all;
width: %;
height:px;
text-align: left;
color: #ffffff;
z-index: ;
font-size: px;
}
</style>
</head>
<body>
<table style="width:%">
<tr>
<td style="width:%">
<div class="edit_div">
<pre id="edit_pre_">


The above code is a pure JavaScript code used to implement the text comparison tool. I hope it will be helpful to everyone!

Statement:
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
Previous article:How to use jQuery to determine whether a Div is in the visible area Determine whether a div is visible_jqueryNext article:How to use jQuery to determine whether a Div is in the visible area Determine whether a div is visible_jquery

Related articles

See more