I have such an Adsense code:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-12345";
/* my advertisement */
google_ad_slot = "2345";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
I have such an js file:
$(document).ready(function() {
var adsenseCode='<script type="text/javascript"><!--
google_ad_client = "ca-pub-12345";
/* my advertisement */
google_ad_slot = "2345";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
$().append(adsenseCode);
}
I tried with double quotes, single quotes, removing comment lines etc. Not found the solution.
How can I print javascript code inside my HTML page?
document.writeafter the page has loaded. It will replace the page contents with the written contents. You should bewriteing in a script tag.