I'm very new to this, so I'm sorry if I cant explain myself properly. I'm running a website with a lightbox for images, inside the lightbox I embeded a link and what I want to do is that link to open a new pop-up window, but I've encountered a small problem on my code:
<a href="images/gallery/1.jpg" class="lytebox" data-title="<br /><a href='javascript:popUp('images/junk1.php')'/>Add a Comment</a>">
<img src="images/thumbnails/1.jpg" border="0">
</a>
You see, when I get to the 'javascript:popUp('images/junk1.php')' I've already used the apostrophes, so it doesn't load. I've been reading about strings being within strings and I've tried escaping it via \ but it doesn't work. Any help?
2 Answers 2
Use HTML entities. Something like this (not tested):
data-title="<br /><a href="javascript:popUp('images/junk1.php')"/>Add a Comment</a>"
Comments
ok.. how about you just change the call around a little.. not sure if this will work, but you could give it a try.
<a href="images/gallery/1.jpg" class="lytebox" data-title="<br /><a data-img='images/junk1.php' onclick='popUp(this.dataset.img)'/>Add a Comment</a>"><img src="images/thumbnails/1.jpg" border="0"></a>
or you can do as rob suggests...
<a href="images/gallery/1.jpg" class="lytebox" data-title="<br /><a href='javascript:popUp("images/junk1.php")'/>Add a Comment</a>">
<img src="images/thumbnails/1.jpg" border="0">
</a>
images/junk1.php) and let a script take care of the rest of the content generation?