load a javascript function via string
<p>How to load a javascript function via string</p>

<pre><code>&lt;div id="test_div"&gt;display here&lt;/div&gt; // &lt; --display here


&lt;script type="text/javascript"&gt;

// string 
var _script=("&lt;script type=\"text/javascript\"&gt;

    var disqus_shortname = 'example'; 
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
&lt;/script&gt;");


// write/output the string
document.getElementById('test_div').innerHTML= _script;
&lt;/script&gt;
</code></pre>
