[thelist] Need some JS help - unobtrusive popup - based onCLASSnot id.

Duncan Hill dunkaz at gmail.com
Fri Jun 15 18:14:44 CDT 2007


On Fri, 15 Jun 2007 21:19:52 +0100, Jon Hughes <hughesj at firemtn.com> wrote:

> Okay, I've got this:
>
> function detpopup() {
> 	var allElems = document.getElementsByTagName('*');
> 	for (var i = 0; i < allElems.length; i++) {
> 		var thisElem = allElems[i];
> 		if (thisElem.className && thisElem.className ==
> 'detpopupcont') {
> 			thisElem.style.visibility = 'visible';
> 		}
> 	}
> }
>
> And I have this:
>
> <img src="mypic.jpg" onmouseover="detpopup();">
>
> And it WORKS!
>
> ... but it pops up EVERY 'detpopupcont' -  Is there a way to only pop up
> the active one?  I really don't want to have separate id's/classes...

Jon is it essential to use javascript, if I am reading it right you could  
do this with only css, by manipulating the hover.
I wrote a photo gallery that uses an unordered list with an id on the  
list, a class to separate vertical images and nothing else. Mouseover  
produces an enlarged view of the image. The technique is just as easy to  
do for text.
Have a look at
http://www.nevilfamily.com/hodgepodge/equip-cemetery/gallery/old-farm-eq-photo-dh.htm
and see if the effect is anywhere close to your needs, I'm happy to trim  
out the required xhtml and the css if it is of use to you.

Duncan



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the thelist mailing list