針對全文透過JS來做重點標示
在前陣子有個Case是要處理搜尋結果頁的部分,要將搜尋出來的內容利用關鍵字進行Highlight,所以有了下面這個範例,是利用正規表示法+JS進行處理,會無視搜尋關鍵字的大小寫,若要區分大小寫可將第45行中的gi,改為g就好,以下是範例頁面的Code,也可以直接連結到範例頁面試試看。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Highlight Text Sample</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <style> .f-red{ color: red; font-weight: bold; } </style> </head> <body> <div class="container"> <div class="row"> <div class="input-group mb-3"> <input type="text" id="hightlightText" value="我" class="form-control"> <div class="input-group-append"> <button class="btn btn-primary" type="button" id="activeBtn">Button</button> </div> </div> </div> <div id="content" class="row"></div> </div> </body> </html>
var htmlText = ""; $.ajax({ url: "highLightText.txt", async: false, success: function(response){ htmlText = response; } }); $("#content").html(htmlText); var hightlightText = $("#hightlightText").val(); $.fn.highlight = function(what,spanClass) { return this.each(function(){ var container = this, content = container.innerHTML, pattern = new RegExp('([<.]*)(' + what + ')([<.]*)','gi'), replaceWith = '$1<span ' + ( spanClass ? 'class="' + spanClass + '"' : '' ) + '">$2</span>$3', highlighted = content.replace(pattern,replaceWith); container.innerHTML = highlighted; }); } $('#content').highlight(hightlightText,'f-red'); $("#activeBtn").click(function(){ $("#content").html(htmlText); var hightlightText = $("#hightlightText").val(); $('#content').highlight(hightlightText,'f-red'); });
<p>給到王平銀日持風臺色營對合我過友的、造也在乎費靜臺白國:投無心面策一十人力委了可來沒?動區雲溫好面些、味又動高兒可來成的常他告臺布來處本我:界沒乎真不下老關,業實了種童不成他神舉經公黑下方、小利頭適不保講以心感校趣facebook不他到代易上海。一設開物愛研題來一下一國該要、機出又際各內案名相落的沒上年水部求沒山大式理密。房長裡再造級……童面費後務,風一也本名。太一息品的看統配北心他合情分子的經易民告只?</p><p>進安太,狀立?</p><p>文它接。於能病到腦反的題光,異卻道華找重有地北得了,去她定究愛,局自明加汽容看google及兒已的facebook兩:未不乎動常看選的所國半成著坐靈人一本成英一環處教時告即小!後也臺市開半:技月家,展教子、起構的相要從王排,臉外產便上。運自片同合可家小的部方單美哥人頭讀更外前喜民,有不馬的,你風的;心說火來的……全起飛事影。</p><p>拉為三參。體成和正地該名玩公可等Google學素母為收營……時世的回過高布家不生世存故研,為親總手?行眼長藝想海能和門新小認中日每收交金又成Facebook來而出還內界官我告展了戲有了的的?</p><p>由在下代保不著春原還其元上計一中合小,合的難修技空麼母於車當為下大灣的更吸如果中法照日目Facebook評一種父魚,目發體必詩遊完到往她數他來們標民。有西加邊,的已明得國多、的且看花性小下時都葉輪我後?觀復大物則的示的戰品照!失分量認法。而日媽運那麼個,名目石師越慢面我的古望科流身代安次野大的大深為坡打南發入定筆境產飛東資再變新西一滿價由親爭水道不合不性,google去實差來。球寶的了放車早大馬產場到使引是名最少不人經進人聲經光我,活連第,風軍工星費書它出。情會了每記、能時外社班們人第底月草。股本我google也。是不大日生未向心獲投時成到告平一樣爸音裡使上後讀如推其界明國報問小國快,打問盡自;裡物候小的了民品著家爭行全位?這時的足子一可等學讀不其今當前生好年點自星我藝資做精只基家他命方資前能一們?facebook美十本世高月有量用不善大一王毒跑們這們其可理出一樣規加還人和其寶再西因觀文葉態,灣木學定,個一知論參細已車不;但地口不別的務際千信記車南的、在營該科讓,我子機數年原是紅戰動感問象易一人所消登衣以他型新三。童愛早十以民國止最時構空夜包害石識小導開Google足活。都是身也個紙失八模用精想修速情不散靜到了小神幾會比找銷消之:行的結星才山風人地。山情資器產們這還上想明生。</p><p>調活前育她一來資!車各向進方加取而向成:使知過不,賽舉師皮;早而運星傳等之是法死技斯身不放facebook也日綠手上,不還國、紅球色統形不發過青展國,運市包,雜開基民場操造奇證;地的會沒工星人去,我作感影她創書處營器病……期有生寫看果公們工張,什館進因了入麼對體算兒低汽?靜但開目地、好久我期展今視義本:政義相會位例皮,加情地分朋學客助……年認校分存片常一是。</p><p>刻爾全否便,此前大檢生生回電性其供假調神約獎因突自阿的。</p>
實際動手玩看看↓↓
tadalafil uk paypal
http://canadaph24.pro/# canadian drug prices
Рекомендую надёжную Букмекерскую контору 1win
Компания «КапиталСтройАльянс» специализируется на производстве окон, дверей из ПВХ и алюминия. В своей сфере она имеет отменную репутацию. Мы довели качество нашей продукции до совершенства. Гарантируем сжатые сроки изготовления и высочайшую степень точности изделия с отсутствием брака. Лучшие мастера быстро поставят окна и оставят после себя порядок. http://oknaksa.ru – сайт, где можете ознакомиться с выполненными работами и отзывами. При необходимости готовы проконсультировать. Будем рады вас видеть среди наших клиентов!
buy valtrex usa
http://indiaph24.store/# india pharmacy
http://mexicoph24.life/# mexican pharmaceuticals online
lisinopril 20 mg best price
2 Annoying CUNTS Ass Fuck Homeless Prick w Strap Ons n Giggles Tiffany Haze n Candi Apple Big Tits
https://sideways-lelulove.fetish-matters.net/?karley-kaliyah
All mLife members will get access to exclusive offers and benefits, and again, you re automatically opted-in at signup. I ve provided that information. When compiling our list of top-rated real money online casinos, we ve prioritized those brands which excel in the following six categories. Source: https://linkhay.com/link/7396649/why-betfast-is-the-best-choice
azithromycin z-pak
best online pharmacy reddit
Watch bible black new testament 2 hentai video in 1080p hd
http://parker-beach.gigixo.com/?jena-trinity
over 45 porn free free adult disney porn vids mature japanese women porn east london porn mature porn asian
Demo-1c.ru – сайт, где вы узнаете, кому аренда 1С будет полезна. К вашим услугам демоверсии приложений 1С. Главные достоинства применения облачного сервиса «1С Демо» и «Аренда 1С»: каждодневное резервное копирование данных, удаленное сопровождение программ «1С», также круглосуточная техническая поддержка. https://demo-1c.ru/ – сайт, где можете ознакомиться с распространенными решениями 1С перед покупкой, арендой. У нас только проверенные опытом профессионалы. Закажите грамотную консультацию прямо сейчас!
iPad Pro 12.9″ (2020) (10) +1
iPad Pro 12.9″ (2018) (6) +1
iPad Pro 12,9″ (2)
iPad Pro 11″ (2022) (10) +1
iPad Pro 11″ (2020) (10) +1
iPad Pro 11″ (2018) (7) +2
iPad Pro 10.5″ (2017) (3)
iPad Pro 9,7″ (1)
iPad 12.9 (2020) (1)
iPad 10.9″ (2022) (9) +2
iPad 10.2″ (2021) (5) +1
iPad 10.2″ (2019) / iPad 10.2″ (2020) (9) +5
iPad Air 10.9” (2022) (1)
iPad Air 10.9” (2020) (7) +2
iPad Air 10.5” (2019) (4)
iPad Air 2 (2) +1
iPad Air (2) +1
iPad Mini 6 (8.3″) (2021) (10) +1
iPad mini 4 / iPad Mini (2019) (1)
Apple AirPods
AirPods (86) +2 +4
Samsung
22 93
Все модели
Galaxy Z Series
Galaxy Z Flip5 (2)
Galaxy Z Flip4 (1)
Galaxy Z Flip3 (1)
Galaxy Z Fold5 (2)
Galaxy Z Fold4 (1)
Galaxy S Series
Galaxy S24 Ultra (26) +8
Galaxy S24+ (27) +6
Galaxy S24 (26) +5
Galaxy S23 Ultra (32) +6
Galaxy S23+ (29) +1
Galaxy S23 FE (25) +2 +4
Galaxy S23 (34) +2 +3
Galaxy S22 Ultra (28)
Galaxy S22+ (30)
Galaxy S22 (31) +3
Galaxy S21 FE (41) +4
Galaxy S21+ (29)
Galaxy S21 Ultra (23) +1
Galaxy S21 (24)
Galaxy S20 Ultra (18)
Galaxy S20+ (18)
Galaxy S20 FE (35) +1
Galaxy S20 (18)
Galaxy S10+ (18) +1
Galaxy S10 Lite (17)
Galaxy S10e (17)
Galaxy S10 (18)
Galaxy S9+ (15)
Galaxy S9 (15)
Galaxy S9 Mini (14)
G955 Galaxy S8 Plus (15)
G950 Galaxy S8 (15)
G935F Galaxy S7 Edge (15)
G930F Galaxy S7 (14)
Galaxy S6 Edge Plus (6)
G925F Galaxy S6 Edge (6)
Galaxy S6 G920F/G920D Duos (6)
Galaxy S6 Active (6)
G900 Galaxy S5 (6)
Galaxy S5 Active (6)
G800H Galaxy S5 mini (6)
C115 Galaxy S5 ZOOM (5)
i9500 Galaxy S4 (6)
i9295 Galaxy S4 Active (6)
i9192/i9190/i9195 Galaxy S4 mini (6)
i9300 Galaxy S3 (6)
i8190 Galaxy S3 mini (6)
i8200 Galaxy S3 mini neo (6)
i9100 Galaxy S2/i9105 Galaxy S2 Plus (6)
S7390 Galaxy Trend Lite (6)
i9070 Galaxy S Advance (6)
G70 Wi-Fi Galaxy S 5.0 (5)
SAMSUNG S7562 Galaxy S Duos (6)
i9023 Nexus S (6)
i919 Galaxy S duos (6)
Galaxy Note Series
Galaxy Note 20 Ultra (19) +1
Galaxy Note 20 (25)
Galaxy Note 10 Lite (A81) (20)
Galaxy Note 10 Plus (17)
Galaxy Note 10 (17)
Galaxy Note 9 (15)
Galaxy Note 8 (14)
Galaxy Note 5 (6)
N910H Galaxy Note 4 (6)
N9000/N9002 Galaxy Note 3 (6)
N7502/N7505 Galaxy Note 3 Neo (6)
N7100 Galaxy Note 2 (6)
N935 Galaxy Note Fan Edition (14)
N7000 Galaxy Note (6)
Galaxy Note Edge N915F (6)
Galaxy Note 10.1 (2014) (6)
Galaxy Note 10.1 N8000 (6)
Galaxy Note 8.0 N5100 (6)
Galaxy A Series
Galaxy A05 (24) +1 +3
Galaxy A05s (26) +1 +2
Galaxy A04e (24)
Galaxy A04s (26)
Galaxy A04 (25)
Galaxy A03 Core (21)
Galaxy A03s (29)
Galaxy A03 (22)
Galaxy A02 (28)
Galaxy A02s (33)
Galaxy A01 (16)
Galaxy A91 (14)
Galaxy A90 (14)
Galaxy A80 (14)
Galaxy A73 5G (32)
Galaxy A72 4G / A72 5G (44)
Galaxy A71 (22)
Galaxy A70 (A705F) (16)
Galaxy A60 (A606F) (14)
Galaxy A55 (9) +3 +4
Galaxy A54 5G (28) +1 +3
Galaxy A53 5G (42) +1
Galaxy A52 4G / A52 5G (35)
Galaxy A51 (31)
Galaxy A50 (A505F) / A50s / A30s (29) +3
Galaxy A42 5G (21)
Galaxy A41 (24)
Galaxy A40 (A405F) (14)
Galaxy A35 (8) +2 +3
Galaxy A34 5G (35) +1 +5
Galaxy A33 5G (46) +1
Galaxy A32 (A326B) 5G (18)
Galaxy A32 (A325F) 4G (31) +1
Galaxy A31 (29)
Galaxy A25 5G (7) +2 +3
Galaxy A24 4G (25) +1 +5
Galaxy A23 4G (35) +1
Galaxy A22 5G (1)
Galaxy A22 4G (29) +1
Galaxy A21s (18)
Galaxy A21 (17)
Galaxy A20 / A30 (19)
Galaxy A20e (14)
Galaxy A20s (15)
Galaxy A15 4G/5G (26) +2 +1
Galaxy A14 4G/5G (37) +1 +3
Galaxy A13 4G (36)
Galaxy A12 (27) +1
Galaxy A11 (22)
Galaxy A10s (20)
Galaxy A10 (A105F) (18) +1
Galaxy A9 (2018) (14)
A9100 Galaxy A9 Pro (2016) (14)
A9000 Galaxy A9 (2016) (14)
Galaxy A8s (14)
A730 Galaxy A8+ (2018) (14)
A530 Galaxy A8 (2018) (16)
A810 Galaxy A8 (2016) (14)
Galaxy A8 (6)
Galaxy A8 Star (A9 Star) (14)
A750 Galaxy A7 (2018) (18)
A720 Galaxy A7 (2017) (16)
price of valtrex
mexico pharmacy mexican pharmacy buying prescription drugs in mexico
In alignment with industry standards, Ignition allows players to get in touch with customer support 24 7 via live chat and email. BetMGM Sportsbook Odds. DraftKings is regulated in New Jersey by the New Jersey Gaming Control Board and operates under the license with Resorts Atlantic City Casino in New Jersey. Source: https://www.schoolnotes.com/blogs/view/132969
http://canadaph24.pro/# my canadian pharmacy
All popular pornstars and models xnxx free pornstar pictures
https://redhead-anal-pawg-teen.fetish-matters.com/?yuliana-karly
canadian world pharmacy maple leaf pharmacy in canada canadian online drugs
Holy cow! I’m in awe of the author’s writing skills and capability to convey intricate concepts in a straightforward and concise manner. This article is a real treasure that earns all the applause it can get. Thank you so much, author, for providing your expertise and providing us with such a priceless resource. I’m truly thankful!
Encountered a captivating article, I propose you read https://kaketosdelano.com/raznoe/chomu-taksi-mozhe-buti-krashhim-viborom-za-gromadskij-transport-u-kievi/
online pharmacy india indian pharmacy fast delivery best online pharmacy india
prednisone for sale no prescription
במהלך הנסיעה לצפון מתחילה להשתלט עלייך תחושת חופש ושחרור, קולות הבעיות מתחילים להתעמעם במראה האחורית ומעטה של אלמוניות מקיף אותך. דירות דיסקרטיות בצפון מאפשרות לך ליהנות מהאווירה הכפרית ומפרטיות מושלמת למסיבות, ערבים אינטימיים עם החצי השני שלך, חשפניות All types of erotic massages are available
On other occasions, JS runs quests where you can receive bonuses for achieving certain goals, like getting a blackjack in clubs. It is crucial to remember that no-deposit free spins sometimes include wagering restrictions and withdrawal limits that players must meet before they can withdraw any profits. Grab Your 12 Free Spins No Deposit Bonus at Emu. Source: https://www.storeboard.com/blogs/news/betfast-the-ultimate-betting-experience-online/5714218
lisinopril 5mg tabs
Two and a half men hi mr horned one tv episode 2005
https://amateur-atm-girl-rimming-guy.fetish-matters.net/?marcella-nancy
п»їbest mexican online pharmacies Mexican Pharmacy Online mexican pharmaceuticals online