用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - javascript代码库

在线代码 ace api

2019-12-10 作者: 朱文波30举报

[javascript]代码库

<script type="text/javascript">
    (function() {
        var editor1 = ace.edit("editor1", {
            theme: "ace/theme/monokai",
            mode: "ace/mode/html",
            wrap: true,
            autoScrollEditorIntoView: true,
            enableBasicAutocompletion: true,
            enableSnippets: true,
            enableLiveAutocompletion: true
        });
        var editor2 = ace.edit("editor2", {
            theme: "ace/theme/monokai",
            mode: "ace/mode/css",
            autoScrollEditorIntoView: true,
            enableBasicAutocompletion: true,
            enableSnippets: true,
            enableLiveAutocompletion: true
        });
        var editor3 = ace.edit("editor3", {
            theme: "ace/theme/monokai",
            mode: "ace/mode/javascript",
            autoScrollEditorIntoView: true,
            enableBasicAutocompletion: true,
            enableSnippets: true,
            enableLiveAutocompletion: true
        });
        var submit = document.querySelector('#submit');
        submit.addEventListener('click', function() {
            var htmlValue = editor1.getValue();
            var cssValue = editor2.getValue();
            var jsValue = editor3.getValue();
            var htmlStr = '<!DOCTYPE html>' +
                '<html>' +
                '<head>' +
                '<meta charset="utf-8" />' +
                '<title>代码测试</title>' +
                '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>' +
                '<meta name="format-detection" content="telephone=no" />' +
                '<meta name="apple-mobile-web-app-status-bar-style" content="black" />' +
                '<meta name="apple-mobile-web-app-capable" content="yes" />' +
                '<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>' +
                '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>' +
                '<style type="text/css">' +
                cssValue +
                '</style>' +
                '<script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js">' +
                '</' +
                'script>' +
                '<script type="text/javascript">' +
                'new window.VConsole();' +
                '</' +
                'script>' +
                '</head>' +
                '<body>' +
                htmlValue +
                '<script type="text/javascript">' +
                jsValue +
                '</' +
                'script>' +
                '</body>' +
                '</html>';
            document.getElementById('preview').srcdoc = htmlStr;
        })
    })()


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...