JS实现简单的运行代码 & 侧边广告

通过llama.cpp与羊驼聊天的网页界面- 详解 Serge 的启动使用

 

/* JS实现简单的运行代码功能 */
<!
doctype html> <html> <head> <meta charset="utf-8" /> <script> window.onload = function() { var oTxt = document.getElementById('codeText'); var oBtn = document.getElementById('btn'); oBtn.onclick = function() { var oNewWin = window.open('about:blank', '_blank'); //在新窗口中打开空白页(BOM) oNewWin.document.write(oTxt.value); //在空白页中写入输入框的值 } } </script> </head> <body> <textarea id="codeText" rows="10" cols="40"></textarea><br /> <input id="btn" type="button" value="运行" /> <!-- FF下只能关闭open打开的窗口 --> </body> </html>

Refer:什么是侧边广告

Link:https://www.cnblogs.com/farwish/p/3861904.html

/* 侧边底部广告 */
<!
doctype html> <html> <head> <meta charset="utf-8" /> <style> #div1 { width:200px; height:150px; background:red; position:absolute; right:0; bottom:0; } body {height:2000px;} </style> <script> window.onscroll = window.onresize = function() { //可视区尺寸 var clientW = document.documentElement.clientWidth; var clientH = document.documentElement.clientHeight; //滚动距离 var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; // IE,FF || chrome //alert(scrollTop); oDiv = document.getElementById('div1'); oDiv.style.top = clientH - oDiv.offsetHeight + scrollTop + 'px';//document.navigater.userAgent判断浏览器类型,IE6使用fixed定位 } </script> </head> <body> <div id="div1"></div> </body> </html>

posted on 2014-07-23 01:49  ercom  阅读(1616)  评论(0编辑  收藏  举报