By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

HTML tags to highlight a text in a target page ?

P: n/a
Hello

I would like to have a hypertext link which, when I click on it, leads
to a web page where a certain word is highlighted. Depending on the
link, the same target page would be displayed but with a different
word highlighted.
A bit like the search on google using the "cached" pages

I have looked in several HTML tutorials, but I haven't found the
answer...
It seems possible to do that using php, but my site is hosted on a
server that does not support php...

Does anyone know how to do this with html tags, or where I could find
the answer ?

Thanks a lot
Christophe
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Christophe Guillon wrote:

I would like to have a hypertext link which, when I click on it, leads
to a web page where a certain word is highlighted. Depending on the
link, the same target page would be displayed but with a different
word highlighted.
A bit like the search on google using the "cached" pages

I have looked in several HTML tutorials, but I haven't found the
answer...
It seems possible to do that using php, but my site is hosted on a
server that does not support php...


What you do is replace in the text you want to output; e.g. 'bla
mykeyword bla' becomes bla '<strong
class="highlight">mykeyword</strong> bla'.
See this Google highlighter for reference:
<http://textism.com/article/638/>

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #2

P: n/a

"Christophe Guillon" <c_*******@yahoo.fr> wrote in message
news:bc**************************@posting.google.c om...
Hello

I would like to have a hypertext link which, when I click on it, leads
to a web page where a certain word is highlighted. Depending on the
link, the same target page would be displayed but with a different
word highlighted.
A bit like the search on google using the "cached" pages

I have looked in several HTML tutorials, but I haven't found the
answer...
It seems possible to do that using php, but my site is hosted on a
server that does not support php...

Does anyone know how to do this with html tags, or where I could find
the answer ?


The HTML in a static page is what it is. You have two means of varying a
page's appearance: server-side code and client-side code. If you don't have
access to PHP or other server-side code generation, then your only choice is
client-side generation, which in turn is only good for clients that run
client-side code. However, if you want to go ahead with this, see

http://gavelcade.com/context-based-d...html?splitting

http://gavelcade.com/context-based-d...ml?highlighted

http://gavelcade.com/context-based-d...ml?punctuation

etc. for a simplistic example.

Jul 20 '05 #3

P: n/a
Christophe Guillon wrote:
Hello

I would like to have a hypertext link which, when I click on it, leads
to a web page where a certain word is highlighted. Depending on the
link, the same target page would be displayed but with a different
word highlighted.


From what you say, I understand you have a set of known links that
should highlight some specific text on known target pages. If I am
right, you could also think of using :target CSS selector, keeping in
mind this is a CSS 3 feature that only last Mozilla/Gecko browsers are
able to render right now.

Basically, you could have your target text properly marked-up in your
target page:
<span class="highlight" id="hid">example</span>

Then somewhere else you have the following link:
<a href="path-to-target-page#hid">link</a>

Plus the following CSS rule:
..highlight:target { background-color: yellow ; }

You can see an example of this at
http://www.relinquiere.com/internals/glossary (each word of the glossary
leads to a highlighted example).
--
Want to spend holidays in France ? Check http://www.relinquiere.com/

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.