我如何从我的JavaScript打印一些东西到JsFiddle的结果屏幕。我不能使用document.write(),它不允许,也不允许打印。

我应该用什么?


当前回答

这里有一个替代方案:http://jsfiddle.net/skibulk/erh7m9og/1/

document.write = function (str) {
    document.body.insertAdjacentHTML("beforeend", str);
}

document.write("¡hola mundo");

其他回答

你可以这样做——> http://jsfiddle.net/chY5y/

$('body').append(yourVariable); 

document.body.innerHTML = "你的数据";

使用alert()函数:

alert(variable name);
alert("Hello World");

这里有一个替代方案:http://jsfiddle.net/skibulk/erh7m9og/1/

document.write = function (str) {
    document.body.insertAdjacentHTML("beforeend", str);
}

document.write("¡hola mundo");

为了能够在JSFiddle中看到console.log()的输出,请转到左侧面板的外部资源,并为Firebug添加以下链接:

https://getfirebug.com/firebug-lite-debug.js