Akki
Akki

Reputation: 1778

why my following fiddle giving output without any print call?

I have one piece of code as:

<script type="text/javascript"><!--
google_ad_client = "ca-pub-8514414755716493";
/* AdX_Washington_Examiner */
google_ad_slot = "9465392777";
google_ad_width = 320;
google_ad_height = 50;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Why this code is giving output as "}//]]>" ??

I have not written any print call still it is giving output..

Here is my fiddle link http://jsfiddle.net/akshaynikte/ryLPf/6/#

Upvotes: 1

Views: 127

Answers (3)

Alex Filipovici
Alex Filipovici

Reputation: 32541

Here are a few excerpts from the jsFiddle documentation page :

The JavaScript panel

Code entered in this panel will be placed in header’s script block, that is between <script type="text/javascript"> and </script>.

The Add Resources section

CSS or JS (with appropriate extension) which should be loaded after the framework. It’s a perfect place to put libraries which are framework independent, like RaphaelJS

So, the correct way to work with the script in your question would be:

  1. Add the following to the JavaScript panel.

    <!--
        google_ad_client = "ca-pub-8514414755716493";
        /* AdX_Washington_Examiner */
        google_ad_slot = "9465392777";
        google_ad_width = 320;
        google_ad_height = 50;
    -->
    
  2. Add http://pagead2.googlesyndication.com/pagead/show_ads.js to the Add resources section on the left side of the page.

Here's a link to a properly configured sample: http://jsfiddle.net/edywd/.

Upvotes: 1

mpm
mpm

Reputation: 20154

<script type="text/javascript"><!--
google_ad_client = "ca-pub-8514414755716493";
/* AdX_Washington_Examiner */
google_ad_slot = "9465392777";
google_ad_width = 320;
google_ad_height = 50;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

you cant use script tags in js textarea of jsfiddle,it is js only, if you want use script tags , put them in the html textarea of jsfiddle

Upvotes: 1

Claudio Redi
Claudio Redi

Reputation: 68400

It seems to be a bug on fiddler (or that it doesn't allow script tags on javascript panel) , if you change the script to anything else, you'll see that it happens the same.

You should place your script on HTML panel, that works fine according my tests.

Upvotes: 1

Related Questions