我想将console.log输出写入div层.
例如:
document.write(console.log(5+1)); //Incorrect, random example
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决问题吗?
谢谢.
编辑:
我的意思是,例如:
console.log("hi");
Run Code Online (Sandbox Code Playgroud)
它在屏幕上显示输出"hi".
注意:一个例子:http://labs.codecademy.com/#:workspace
我有一个iframe,我需要它有一个滚动溢出.它似乎在桌面上工作,我使用了一个解决方案,使其在iOS中工作.它现在适用于Android和iOS.但是,iOS8失败了.
<html>
<body>
<style type="text/css">
.scroll-container {
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
#iframe_survey {
height: 100%;
}
.scroll-container {
height: 100%;
width: 100%;
overflow: scroll;
}
</style>
<div class="scroll-container scroll-ios">
<iframe id="iframe_survey" src="www.iframe.com" style="border:0px #FFFFFF none;" name="myiFrame" frameborder="0" marginheight="0px" marginwidth="0px" width="100%"></iframe>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
我找不到一个有效的答案.我有一个iframe(是的,我必须在这种情况下使用iframe)在PC上正常工作,但根本不会在手机或平板电脑上加载.
页面上有一些Javascript但删除它并不能解决问题.我也尝试将iframe的高度和宽度从百分比更改为固定值.我还尝试从iframe中删除所有属性src,但仍然没有在iframe中加载任何内容.
下面是我的页面的简化版本,使用我从其他建议中可以找到的内容.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<style type="text/css">
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden; -webkit-backface-visibility: visible;
}
#content
{
position:absolute; left: 0; right: 0; bottom: 0; top: 0px;
}
</style>
</head>
<body>
<script type="text/javascript">
function onFrameLoad() {
do stuff
};
</script>
<div id="content">
<iframe onload="onFrameLoad(this)" id="app" src="https://subdomain.mydomain.com" frameborder="0" height="100%" width="100%"></iframe>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我为什么它不能在移动设备上工作?谢谢
更新:清除平板电脑上的浏览器缓存修复它,但在移动设备上做同样的事情并没有做任何事情.我也尝试过使用我朋友的iPhone(他们之前从未访问过该网站)并且没有加载.
我试图在iframe中显示的网址在我的手机上的w3schools等演示网站上的iframe中运行,因此它不是一个x-frame options或浏览器不允许任何iframe问题(尽管x-frame选项会阻止它在所有设备上工作,但我'我检查了我能想到的一切)
如果需要,我可以通过消息提供实时示例URL.