如何讓它全文匹配
html + js 代碼
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function searchVal(){
var text = document.getElementById("text").value;
var textRange = document.body.createTextRange();
var s = textRange.findText(text);
if (s) {
textRange.scrollIntoView();
textRange.select();
var myTextRange2=document.createRange(text);
console.log(myTextRange2);
}else
return;
}
</script>
</head>
<body>
<div style="height: 100px;">
</div>
<div style="height: 100px;">
1、45648897454。
</div>
<div style="height: 100px;">
2、據 Ben Geskin 推文顯示,三星 S10 果真具有早先已傳聞的“打孔屏”設計。對此,營長并不覺得是什么稀奇的事,因為近幾年手機市場的廠商們,幾乎都在盤算著如何“以貌取勝”,同時,配備讓智能手機更智能的 AI 技術也是如今手機的一大賣點。
</div>
<div style="height: 100px;">
2015年,三星風投投資了區塊鏈消費設備ADEPT;。
</div>
<div style="height: 100px;">
2016年,三星集團旗下最大子公司三星資料系統(Samsung SDS)宣布,將投資一家為公司提供基于區塊鏈開發平臺的當地公司,理由是區塊鏈技術是足以改變世界的金融創新技術;
</div>
<div style="height: 100px;">
2017年,三星建立以云計算為主的企業級區塊鏈平臺 Nexledger;
</div>
<div style="height: 100px;">
2018年1月,三星資料系統宣布投資兩家初創公司,其中一家為韓國區塊鏈公司 Blocko,另一家為英國網路安全公司 Darktrace;
</div>
<div style="height: 100px;">
2018年4月,三星開始為 Halong Mining 的 DragonMint T1 礦機生產 10nm 芯片。
</div>
<div style="height: 100px;">
2018年9月,三星 SDS 與韓國海關、韓國銀行等合作開發區塊鏈認證平臺,
</div>
<div style="height: 100px;">
2018年10月,三星與荷蘭銀行 ABN AMRO 展開區塊鏈貿易試點專案。
</div>
<div style="height: 100px;">
2019年1月23日,據一位名為 Ben Geskin 的推特網友爆料,三星 Galaxy S10 手機將內置區塊鏈數字錢包服務,并首次報道于三星新聞網站 SamMobile。但截止到撰稿時間,三星對此并沒有做出任何回應。但種種跡象表明,這次真有點實錘的意思!
</div>
<div style="height: 100px;">
6666666666666
</div>
<div style="position: fixed; right: 20px; top: 0;">
<input type="text" name="text" id='text'>
<button type="button" onClick='searchVal()'>Search for a</button>
<!-- <button type="button" onClick='findString("2018")'>Search for Orange</button> -->
</div>
</body>
</html>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/250408.html
標籤:JavaScript
上一篇:web代碼決議
