What you are doing is a very bad practise. May be you could try the below inside your html
<script type="text/javascript">
var recaptcha = "<?php echo recaptcha_get_html("XXX"); ?>";
if (document.getElementById("tester") != undefined)
{
document.write('<form method="post" action="index.php">'+recaptcha+'
<br /><input type="submit" value="CLAIM" /></form>');
}
else
{
document.write('<p>We\'ve detected that you\'re using <strong>AdBlock Plus</strong> or some other adblocking software. Please be aware that this is only contributing to the demise of the site. We need money to operate the site, and almost all of that comes from our online advertising. To read more about why you should disable ABP, please <a href="#">click here</a>.</p>');
}
</script>
However if you really want to use it, find below what i think the problem is
document.write(\'
We\'ve detected that you\'re using AdBlock Plus or some other adblocking software. Please be aware that this is only contributing to the demise of the site. We need money to operate the site, and almost all of that comes from our online advertising. To read more about why you should disable ABP, please click here.
\');
will be interpreted incorrectly as there are 4 single quotes here which you are getting confused with. The string given as input to document.write should have only type of quote either double or single so you can write your above code in two ways
document.write(\'<p>We\\\'ve detected that you\\\'re using <strong>AdBlock Plus</strong> or some other adblocking software. Please be aware that this is only contributing to the demise of the site. We need money to operate the site, and almost all of that comes from our online advertising. To read more about why you should disable ABP, please <a href="#">click here</a>.</p>\');
document.write(\"<p>We\'ve detected that you\'re using <strong>AdBlock Plus</strong> or some other adblocking software. Please be aware that this is only contributing to the demise of the site. We need money to operate the site, and almost all of that comes from our online advertising. To read more about why you should disable ABP, please <a href=\\\"#\\\">click here</a>.</p>\");
It is important that the quotes inside document.write(''); should be double escaped because lets take an example:
you want to print in html => We've a nice dog
So from javascript it should be = > document.write('we\'ve a nice');
So for you to get \' inside document.write from php it should be =>
echo 'document.write(\'we\\\'ve a nice\');';
because \\\'
in php will become \' in javascript which will inturn become ' in html