1

我有一个相当讨厌的 facebook 字符串要在 javascript 中打印。如何使用这些变量在 html 中动态打印它。我尝试了转义功能,但它给了我一个错误。

$(document).ready(function() {
// var cw = $('#container').height();
var ch = innerHeight;
var cw = innerWidth;

if (ch<601){  // 800 height
        var boxHeight = 70;
        var connections = 0;
    var contentHeight = 70;
     }

// some more code

var code = escape(<iframe width=\"100%\" height=+boxHeight+scrolling=\"no\" frameborder=\"0\" id=\"532808336752730\"           name=\"532808336752730\" class=\"ign\" src=\"//mj89sp3sau2k7lj1eg3k40hkeppguj6j-a-sites-opensocial.googleusercontent.com/gadgets/ifr?
url=http://www.gstatic.com/sites-gadgets/iframe/iframe.xml&amp; container=enterprise&amp;
view=default&amp; lang=en&amp; country=GB&amp; sanitize=0&amp; v=c7249922a405f702&amp;
libs=core&amp; parent=https://sites.google.com/site/fbinttest/open-graph-widgets---like-box#up_scroll=no&amp;up_iframeURL=http://www.facebook.com/plugins/likebox.php?
id%3D532808336752730 
%26 width%3D220
%26 connections%3D+connections+ 
%26 stream%3Dfalse
%26 header%3Dfalse
%26 height%3D+contentHeight+&amp;
st=e%3DAIHE3cC8keZ4jWCwAVS5J7Ace2UnSrmYsNC4bvRK2Oq2MwcECDrHk90njmz6u0td%252FXLpfJH6Mhb50okeZyp3yufxzWcghX8yUJQHe8TpzAERAjXXy2gv8HvVkOagM%252F8aKaFDi66dO6Kh%26c%3Denterprise&amp;rpctoken=-532808336752730\"></iframe>);

print c0de;
4

0 回答 0