Login   Register  
Icontem

File: example.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2011-07-31 10:21
Size: 1,571 bytes
 

Contents

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
**************************************************************/
-->
<html>
<head>
</head>
<body>
<div>
	Some text and notext
	<p>Text in paragraph</p>
</div>
</table>
<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
	attributes:{
		href: "#click",
		rel: "click"
	},
	//elements css styles
	css:{
		color: "green",
		fontWeight: "bold"
	},
	//some event callback functions with event objects
	events:{
		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
});
hl.highlight();
</script>
</body>
</html>