How to highlight search string in HTML - html

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>

Related

Angular 2 Dropdown option format part of the string

We have a requirement where the dropdown option list has three parts.
1 - A code part like , 1 , 2 , 2c, 3, 3d etc.
2 - A company name part , like Columbia Water
3 - A color part, like Green, Orange etc.
I want to change the format of the text partially inside the string.
**2c** Columbia Water Green
I have tried this :-
<div>
<select> <!--[ngStyle]="{'color': 'black','font-size': '20px','font-weight': 'bold'}"-->
<option>
<li><font color="black"><b>2c</b> Columbia Water </font><font color="green">Green</font></li>
</option>
</select>
If I put the ngStyle portion in the tag, only the selected dropdown will be formatted , and that too the entire string.
The same goes for option, the entire string is formatted.
I tried putting li inside of option, but that does not do anything to the string itself.
Is this possible at all, this will be very useful as this will run on android as a hybrid cordova app.
Use a span tag on each of the options and style appropriately in CSS.
<span class='part-code'>2c</span>
<span class='company-name'>Columbia Water</span>
<span class='part-color'>Green</span>

Telephone number not clickable

In my markup, I have included a phone number that I want to be clickable.
This is my code -
<h3 class="footer">Need help? Call 1800 06X XXX</h3>
When I run this code I see two red brackets around the phone number with a small chain like icon that says "invalid link". The number is not clickable.
Please help!
That should be
1800 06X XXX
note the //...

How can I prevent redundant values from being displayed in a column in an SSRS report?

I have the Textbox in the data row set up in the usual way, with an expression like so:
=Fields!Description.Value
The data is being extracted and displayed fine, in fact too well for my tastes, as the Description is repeated N times; I want only the first unique value to display, and for it to be invisible after that until the Description changes. IOW, if it starts off with "Green Bay Packers" 80 times, I only want the first one to display that value, and the Description to not be visible again until its value changes to "Minnesota Vikings" (or whatever).
IOW, I want it to look like this:
Green Bay Packers Aaron Rodgers
Clay Matthews
Julius Peppers
Eddie Lacey
...not like this:
Green Bay Packers Aaron Rodgers
Green Bay Packers Clay Matthews
Green Bay Packers Julius Peppers
Green Bay Packers Eddie Lacey
The TextBox does have a "HideDuplicates" property, but the accepted values are not the expected (by me) true and false; they are, instead, the following:
None
CPSData (the name of the data set the report uses)
Details
I can't see how choosing any of these would help me.
How can I effectively set "HideDuplicates" (or the appropriate property) to false?
The HideDuplicates property is the way to do this. The options in the list are the scopes that are applicable within that section of the report. Choose one, and run the report in preview mode to see the results. If the results are not what you expect, try another option. It isn't terribly intuitive how it works, but it does work for me.

how to display data in html

In my project, I am retrieving an address from the database and displaying this address on page. The issue or problem that I am facing is the the way the retrieved address is being displayed.
Basically this is the way the address is being displayed:
Address: 1 Kings Street Kilmarnock East Berkshire Scotland KA1 UIT
I would like the address to be displayed like so:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
How can I do this in HTML or css? I am currently using twitter bootstrap , and I don't if there is anyway to do using it.
Oh.. It's hard but let me try... ;)
<div>Address: 1 Kings Street<br> Kilmarnock <br>East Berkshire<br> Scotland <br>KA1 UIT</div>
Your Expected Output:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
Working Demo
Note: This is just simplest and basic way.. But if Data is coming from any database dynamically then at-least you should explain in details from where it comes and by which object it can be accessible.. Then you can apply JS or regex functions... I hope you understand what I mean..
If you edited the data in your database, and used a comma between each line, you might be able to split the data. (your question doesn't state what language you are writing in (mvc/how data is being received).
However, once you have the string, you can use the String.split method (available in most languages), and hence could adapt your view accordingly.
So,
Address: 1 Kings Street, Kilmarnock, East Berkshire, Scotland, KA1 UIT
would become
{1 Kings Street}{ Kilmarnock}{ East Berkshire}{ Scotland}{ KA1 UIT}
which you could then do a foreach block, displaying them onto the screen as you requested
A possible alternative (although probably not easy), would be to extract the postcode, and call a google maps API call to receive the address - but again, this would be quite difficult.
At present, I cannot see how you would be able to expect a program to decide where to split the address into separate lines (unless you place them into different fields which was described in the comments).
You can add <p> to each line, or put <br> at the end of each lines.
But
If your retrieving the data from a database through a php variable you cannot do that with pure html / css, you'll need string manipulation with PHP.

Select all text before <br>

I have the following awful HTML:
<p>
102036 - <em>In re</em> State v. Williams video<br>
104236 - University of Kansas Hosp. Auth. v. Board of Wabaunsee County Comm'rs video
</p>
I want to use XPath to capture all of the text following each </a>, so:
Item 1: " - In re State v. Williams
Item 2: " - University of Kansas Hosp. Auth. v. Board of Wabunsee County
Alternatively, I could just capture all text, and that would be fine too:
Item 1: "102036 - In re State v. Williams
Item 2: "104236 - University of Kansas Hosp. Auth. v. Board of Wabunsee County
I've been trying various things for a while now, but making no progress. I want something like:
/a/following::text()[before::br]
Help?
Here you go, pal:
//a//following-sibling::text() | //a//following-sibling::*[not(self::a)]/text()
The best thing I've found so far is to simply nuke the errant <em> nodes.
So:
elem = html.xpath('//p')[0]
etree.strip_tags(elem, 'em')
Then, using the cleaner html, a simple XPath can be used:
texts = [e.tail for e in elem.xpath('//a')]
Credit where due: https://stackoverflow.com/a/8788559/64911
If you have firebug installed and are running Firefox, for this and all future xpath needs you can just follow this tutorial:
http://www.wikihow.com/Find-XPath-Using-Firebug
Very easy way to find the xpath for anything on a page.