Lo peeps, got a bit of a weird one..
I'm building a new page for our current website, which is fully database driven (at last), and there's a section of the page where we have a bunch of thumbnails so potential customers and see a few pictures of the holiday cottage etc. With the old static pages they used to open in a multitude of pop-up windows, but I thought I'd do something nicer and have them use the overlib library..
This works pretty well in just about all cases, except for this one image, where it refuses to pop the layer up, and the javascript console then wibbles about this:
Error: missing ) after argument list
This is the code that generates the thumb+pop layer:
Code:
onclick="return overlib('<p class=\'popup_caption\'><img src=\'../cottage_images/<%=rsCottages("FileName")%>.jpg\' alt=\'Larger image: <%=rsCottages("Caption")%>\' class=\'photo_popup\'><br /><%=rsCottages("Caption")%></p>', FGCOLOR, '#FFFFFF', WIDTH, 400, HEIGHT, 330, STICKY, CAPTION, 'Hoseasons Country Cottages - <%=strSiteName%> - Larger Picture', CENTERPOPUP, SHADOW, SHADOWOPACITY, 60, SHADOWY, 10, SHADOWX, 10, CLOSECLICK);"
and this is the data that populates the variables:
FileName = "A927_4_E2269-DEV-05DISK"
Caption = "View of water garden from Bella & # 39 ; s Cottage patio."
(spaces so the entity actually displays in vbulletin)
Now I presume that this is due to the non-escaped html entity in the caption, the question is, how the heck do I escape it for javascript when it's in the middle of a database entry, without having to fanny about with string replacements?