[WEB4LIB] Dynamic HTML and highlighting

Brandon Dennis bdennis at shreve-lib.org
Wed Dec 8 10:29:36 EST 2004


John - 
Your best bet is to probably use a javascript array that will read
through all the values and change the style sheet based on which button
is selected.  I haven't really thought about the best way to do that,
but you would probably be best to create a separate style sheet for each
highlight option you want (name, address, etc.)
 
If you're just highlighting the name, then it should be pretty easy to
use a simple "change style sheet" javascript element on the checkbox.
 
Take a look at this site for some good ideas along these lines:  (Note:
click cancel when it asks if you want to go to the new site)
http://www.xs4all.nl/~ppk/js/changess.html
 
Best of luck!
Brandon
 

	-----Original Message----- 
	From: John Fitzgibbon [mailto:jfitzgibbon at galwaylibrary.ie] 
	Sent: Wed 12/8/2004 5:16 AM 
	To: Multiple recipients of list 
	Cc: 
	Subject: [WEB4LIB] Dynamic HTML and highlighting
	
	

	Hi,
	
	I have created a HTML document with people's names marked up as
follows
	<span class=3D"person">John Doe</span>.
	
	I wish to allow users to highlight all names on the web page by
ticking
	a checkbox labeled 'Highlight'.
	
	I can use JavaScript to dynamically change the background color
of an
	element using 'onclick=3D"this.style.backgroundColor=3D"' If I
am seeking=
	=20to
	reference all span elements in the document with an attribute of
class
	whose value is person how do I proceed? Is it possible





More information about the Web4lib mailing list