javascript - Highlighting text in a new window -



javascript - Highlighting text in a new window -

i trying create recipe page user can click recipe ingredient (e.g. olive oil, broccoli, etc.) , redirected list of ingredients ingredient clicked highlighted in yellow.

i know how highlight text specific link:

css:

.highlight {background-color:yellow;}

javascript:

function highlighttext(id) { var textobject = document.getelementbyid(id); textobject.classname = "highlight"; }

html:

<h1 id="ingredient">olive oil</h1> <a href="javascript:highlighttext('ingredient')">olive oil</a>

what create link "olive oil" page, way using id attribute:

<a href="http://www.mypage.com/recipe-list.html#ingredient"> olive oil </a>

i appreciate , help. first post, please excuse me asking such simple question.

use target selector

:target{ background-color:yellow; }

an article selector

javascript html css

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -