cnblogs美化——在部落格文章插入“可執行"js程式碼
阿新 • • 發佈:2020-08-18
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="width: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一致即可!!
效果: