利用JS实现在文本框输入代码可以在网页上直接运行调试,代码如下:
<center> <table style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellspacing="0" cellpadding="0" border="0" borderlight="green"> <tbody> <tr> <td align="middle"><span class="STYLE2"><font color="red">请在下面窗口中输入HTML代码</font></span></td> </tr> <tr> <td align="middle"> <form name="script"> <textarea name="tester" rows="8" wrap="off" cols="50"></textarea> <br> <input onclick="test()" type="button" value="显示"> <input onclick="trestart()" type="button" value="清除"> <input onclick="about()" type="button" value="关于"> <input onclick="help()" type="button" value="帮助"> </form> </td> </tr> </tbody> </table> </center>
<script> function trestart() { if (script) { clear = confirm("确定要清除吗?", ''); if (clear) { document.script.reset(); document.script.value = ""; } } } function test() { { temp = document.script.tester.value; testwin = open("", "testwin", "status=no,menubar=yes,toolbar=no"); testwin.document.open(); testwin.document.write(temp); testwin.document.close(); } } function about() { alert("HTML代码直接显示出页面来") } function help() { OpenWindow = window.open("", "newwin", "height=220,width=470,toolbar=no,scrollbars=" + scroll + ",menubar=no"); OpenWindow.document.write("<body bgcolor='white' text='black' alink='blue'vlink='blue' link='blue'><TITLE>帮助信息</TITLE>") OpenWindow.document.write("<center>你只要把你想显示的代码放到上页的输入框中,你自己也可以写代码,按显示键就能显示你的页面内容</center><br>") OpenWindow.document.write("<center><a href='javascript:close()'>关闭本窗口</a></Center>") OpenWindow.document.close() self.name = "main" } </script>
注:需要jq库支持。
Swiper默认的切换时间曲线是ease,可以通过添加css3的transition-timing-function属性来改变。 改变Swiper切换的时间曲线 .swi
js判断如果不是访问的指定网址(页面),则弹出提示,然后跳转到指定页面,代码如下: if(location.toString().indexOf(
addCopy=function(evt){constcopyText=\r\n(此处为复制信息!);evt.preventDefault()//防止上面的链接打开URLevt.clipboardData.setData(Text,w
利用js判断当div为空时隐藏相关代码如下: divclass=swiper-slidedata-src=这里是地址ahref=#target=_blankimgsrc=这里是地址data-ti
页面上引用js文件: scripttype=text/javascriptsrc=instantclick.min.jsdata-no-instant/scriptscripttype=text/javascriptsrc=spirits.js/script scrip