File: example.html

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Highlighter  >  example.html  >  Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Example script
Class: Highlighter
Highlight words in HTML pages
Author: By
Last change:
Date: 9 years ago
Size: 1,571 bytes


Class file image Download
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
 * Feel free to distribute and modify code, but keep reference to its creator
 * This object can highlight specified words in a website. 
 * You can provide HTML element which should wrap each word, as well as
 * its attributes and css styles and three events (mouseover, mouseout, click)
 * For more information, examples and online documentation visit: 
 * http://webcodingeasy.com/JS-classes/Highlight-words-in-website-using-javascript
	Some text and notext
	<p>Text in paragraph</p>
<script type="text/javascript" src="./highlighter.packed.js" ></script>
<script type="text/javascript">
var hl = new highlighter();
hl.add("text", {
	//html element in which to wrap text
	html: "a",
	//element attributes
		href: "#click",
		rel: "click"
	//elements css styles
		color: "green",
		fontWeight: "bold"
	//some event callback functions with event objects
		onclick: function(){
			alert("You clicked me");
		onmouseover: function(e){
			e = (!e) ? window.event : e;
			e.target.style.color = "red";
		onmouseout: function(e){
			e = (!e) ? window.event : e;
			e.target.style.color = "green";
	//case insensitive search
	ci : true