The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS using CSS to add/remove highlighting Reply To: using CSS to add/remove highlighting


I got an idea; use “onclick.”

ID the spans you want highlighted

`<span id="highlight">THIS IS THE TEXT TO BE HIGHLIGHTED </span>`

Add JavaScript function to change the background color

 function highlight() {document.getElementById('highlight').style.backgroundColor = "yellow"; }

Then, add this to your buttons:

 <input type = "button"  onclick = "highlight();">

You could place all this in your HTML page; or could split it up.

I am not used to putting html code in these things and still don’t know all the tricks. It took me a month to find out people are using “blockquote” I don’t know if I should use the code span to display code, single quotes, pre, or type the ASCII code right into these pages.

I’m using the same technique to style different entities, such as the body and text; but not highlighting. The concept’s the same.