zoukankan      html  css  js  c++  java
  • cnblogs美化——在博客文章插入“可运行"js代码

    1.添加css,js文件

    操作:管理-设置-页首Html代码中插入以下代码

    <link href="http://files.cnblogs.com/rubylouvre/mystyle3.css" rel="stylesheet" type="text/css">
    <script src="http://files.cnblogs.com/rubylouvre/myjs2.js" type="text/javascript"></script>

    2.编辑文本,转为html源码编辑模式

    插入文本域和运行按钮

    <textarea id="runcode1" style="80%" rows="10"> <!--你的html代码,以下是样板-->
    <!doctype html>
    <html dir="ltr" lang="zh-CN">
        <head>
            <meta charset="utf-8"/>
            <meta http-equiv="X-UA-Compatible" content="IE=Edge">
            <script type="text/javascript">
                alert('可以运行!')
            </script>
            <title></title>
        </head>
        <body>
            <h1>测试一口吧!</h1>
        </body>
    </html>
    </textarea>
    
    <p><button class="runcode" title="runcode1">运行代码</button></p>
    文本域的id不能重复,要与运行按钮的title一致即可!!

    效果:

  • 相关阅读:
    禁止google浏览器强制跳转为https
    遍历打印文件目录结构
    添加忽略文件
    部署git服务器
    Location, History, Screen, Navigator对象
    Window 对象
    回调函数,setTimeout,Promise
    闭包
    this
    函数内部运作机制—上下文
  • 原文地址:https://www.cnblogs.com/kitor/p/13520494.html
Copyright © 2011-2022 走看看