• 代码操作


    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="UTF-8">

        <meta name="Author" content="JunjunChen">

        <title> 代码操作</title>

        <link rel="Shortcut Icon" href="__ROOT__/favicon.ico">

        <link rel="Bookmark" href="__ROOT__/favicon.ico">

        <meta name="keywords" content="代码操作" />

        <meta name="description" content="代码操作" />

        <script type="text/javascript" src="https://file.alonesky.com/jscss/jquery.js"></script>

        <style type="text/css">

        #softpara_main_left textarea {

            font-family: Courier New;

            550px;

            height: 142px;

            font-size: 9pt;

            border: 1px solid #B5C3D3;

            padding: 10px;

            margin-bottom: 6px;

        }

        </style>

    </head>

    <body>

        <div id="softpara_main_left">

            <textarea name="content" id="content">

    <!doctype html>

    <html>

    <head>

        <meta charset="UTF-8">

        <title>蓝色理了个想</title>

        <style>

        .wrap {}

        .wrap .box {

            border: 2px solid red;

            200px;

            height: 200px;

            float: left;

            margin-right: 10px;

            margin-bottom: 10px;

        }

        .wrap .box:hover h1 {

            display: block;

        }

        .wrap .box h1 {

            background: #333;

            color: white;

            display: none;

         }

         </style>

    </head>

    <body>

        <div>

            <div>

                <h1>明天还爱我</h1>

            </div>

            <div>

                <h1>东北松花江</h1>

            </div>

            <div>

                <h1>希望的田野</h1>

            </div>

        </div>

    </body>

    </html>

    </textarea>

        </div>

        <input type="button" name="Submit" value="运行代码" onclick="runCode('content')">

        <input type="button" name="Submit3" value="全选代码" onclick="$('content').select();">

        <input type="button" name="Submit4" value="复制代码" onclick="oCopy('content')">

        <input type="button" name="Submit2" value="保存代码" onclick="saveCode('content')">

    </body>

    <script type="text/javascript">

    var Array();

    var userAgent = navigator.userAgent.toLowerCase();

    var is_opera = userAgent.indexOf('opera') != -1 && opera.version();

    var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);

    var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);

    Array.prototype.push = function(value) {

    this[this.length] = value;

    return this.length;

    }

    function $(objname) {

    return document.getElementById(objname);

    }

    function runCode(objname) {

    var winname = window.open('', "_blank", '');

    var obj = $(objname);

    winname.document.open('text/html', 'replace');

    winname.opener = null; // 防止代码对论谈页面修改

    winname.document.write(obj.value);

    winname.document.close();

    }

    function saveCode(objname) {

    var winname = window.open('', '_blank', 'top=10000');

    winname.document.open('text/html', 'replace');

    var obj = $(objname);

    winname.document.write(obj.value);

    winname.document.execCommand('saveas', '', 'code.htm');

    winname.close();

    }

    function oCopy(objname) {

    var obj = $(objname);

    obj.select();

    js = obj.createTextRange();

    js.execCommand("Copy");

    alert("提示:代码已经被成功复制!");

    }

    </script>

    </html>

  • 相关阅读:
    随机取出数组中的某些值,并删除它们array_splice,array_slice
    取出第一个和最后一个数组元素的值
    array_multisort函数,以及多维数组下排序的应用,并与usort函数对比
    js中数组的使用
    js中var
    linux中分区、格式化文件系统、挂载
    创建一个目录的软连接ln -s和打印当前目录pwd的一个知识点
    [Poi2014]FarmCraft 树状dp
    bzoj 4832 抵制克苏恩 概率期望dp
    noip 2015 斗地主 大爆搜!!!
  • 原文地址:https://www.cnblogs.com/alonesky/p/9954078.html
Copyright © 2020-2023  润新知