0

How can create browser page with browser ? Like for example test environment provided in w3schools.com, we can not see the code

4

3 回答 3

2

iFrame 是 W3Schools 使用的,但您也可以不使用 iFrame。实际页面的设计取决于您,但这里是使用纯 Javascript/HTML 进行设计的基本框架。

<html>
<head>
    <title>Test Page</title>
</head>
<body>
<script type="text/javascript">
function updateDiv() {
    myTextArea = document.getElementById('myTextArea');
    contentDiv = document.getElementById('contentDiv');

    contentDiv.innerHTML = myTextArea.value;
}
</script>

<textarea rows="8" cols="60" id="myTextArea"></textarea><br />
<div id="contentDiv"></div><br />
<input type="button" value="Update!" onclick="updateDiv()" />
</body>
</html>
于 2012-06-28T08:54:01.883 回答
1

You can use an iframe to create "another browser page". See iframe for more information

于 2012-06-28T08:44:12.993 回答
-1

有很多方法,但几乎所有方法都基于浏览器中的 ContentEditable 组件。

ContentEditable 是一个低级功能。可以通过 Javascript 库(例如TinyMCECKEditor )获得更高级别的支持。

带有源的演示:http: //html5demos.com/contenteditable/

微软文档:http: //msdn.microsoft.com/en-us/library/ms537837%28v=vs.85%29.aspx

Mozilla 文档:https ://developer.mozilla.org/en/HTML/Content_Editable

于 2012-06-28T08:51:50.150 回答