I am incorporating a freeware code onto my site I got from another site. Long story short, the code creates a popup of a large image when a thumbnail is clicked on (but not a new window – the popup is a hidden DIV on the same page).
None of that is particularly relevant except that there is a bug that is causing issues. I will note now that I’m not particularly experienced in JS, but I do have a moderate programming background.
This is the HTML code to call the popup:
<a href=”URL to large image” rel=”functionname” title=”caption for image” credit=”another caption”>
<IMG SRC=”thumb URL” title=”normal title tag”/></a>
IE: it’s all called by the href tag.
So where the problem comes in is in the popup. The JS (external file) creates an array for each image on the page of [0
To obtain this information, the function uses the method:
imageLink.getAttribute(‘title’) or imageLink.getAttribute(‘credit’)
The issue is this: Some of my captions include ampersands (&). This has been tested with ‘&’, ‘&’ ‘&#number’; (I forget the correct number) and a few other codes. It’s not really important what I tried. The important thing is that in IE (at least IE6), if the caption was “Me, Bob & Joe”, what prints is “Me, Bob “. I’ve confirmed that the variable being asked to print is the cutoff one, so the problem isn’t in the printing of the string, but in the retrieval by getAttribute (as far as I can determine). This issue isn’t present in Firefox.
I have further discovered that what is cutoff is only the LAST ‘&’ and everything after. So ‘1&2&3&4’ would print ‘1&2&3’. I have ‘avoided’ the situation by putting at the end of every caption with an ‘&’. This means in Mozilla there’s a space at the end, and in IE6, there isn’t one. So it’s no big deal. But It’s a hassle to put it into the captions and I’d prefer a solution that solves the problem, and doesn’t just avoid it.
Can anyone help? (Appologies if this has been addressed. I looked far and wide and I couldn’t find an answer).
Thanks very much