开发者

How to highlight search string in HTML

开发者 https://www.devze.com 2023-01-31 03:20 出处:网络
I\'m using CGI script to create a Telephone Directory(Web based):If I give \"ashok\" the results will be as shown below.But I want to highlight the string \"ashok\" in the results(In the HTML page).Ho

I'm using CGI script to create a Telephone Directory(Web based):If I give "ashok" the results will be as shown below.But I want to highlight the string "ashok" in the results(In the HTML page).How Can I do that?

NAME    PHONE No.   CITY开发者_如何转开发    STATE   ADDRESS
Ashok   0956-253545     Gangtok     Sikim   H.no:A-22/54,lalnagar near kurji road,PIN::600033
Ashok Singh     0992-765876     punjab  Punjab  H.no:B-33/7,yerrakonda,ambedkar road,Pin:800234
Ashok Singh Sai     0452-764876     Gorakhpur   Sikim   H.no:B-23/7,konda,Bapuji road,Pin:4500234


Well it depends how you have the data laid out. If you have it as a table, set the cell's background colour, if not wrap the text to be highlighted in a <span> and set the background colour on that. It will give an impression like Google's cached pages highlight search terms.

<span style="background-color: #0dd;">Ashok</span>
0

精彩评论

暂无评论...
验证码 换一张
取 消