常用html、demo代码
发布时间:2015-10-15, 14:45:06 分类:HTML | 编辑 off 网址 | 辅助
图集1/30
正文 9756字数 27,226,273阅读
暗网网址导航hidden wiki
http://zqktlwi4fecvo6ri.onion
Run code
Cut to clipboard
HTML特殊字符编码对照表
console.log(allnum);
javascript:;
vertical-align:middle;
strconv=yes+js
echo str_ireplace("WORLD","Shanghai","Hello world!");//不区分大小写
<a href="javascript:scroll(0,0)">返回顶部</a>
jquery多个节点绑定同一个事件
$('#begin,#end') 用逗号隔开
target="_blank"
index.php?g=Admin&m=Login
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
location.href = url;
autocomplete="off"
<form name="input" action="html_form_action.asp" method="get">
Username:
<input type="text" name="user" />
<input type="submit" value="提交" />
<input type="button" value="提交">
</form>
$.ajax({
type: "POST",
url:'/index.php?g=User&m=Post&a=Message&ajax=ajax',
data:$('#myform').serialize(),
error: function(request) {
alert("提交失败");
},
success: function(data) {
if(data>0){
alert('留言提交成功!');
location.reload();
}else alert("提交失败");
}
});
function ajaxpost(tel,pass){
$.ajax( {
url:"/index.php/Home/Register/is_login.html",
type: "post",
data:"tel="+tel+"&pass="+pass,
//dataType: "json",
//cache: false,
//async: false,
beforeSend: function(){
// Handle the beforeSend event
},
success: function(data){
}
});
}
<a href="javascript:scroll(0,0)">顶部</a> <a href="#copy">底部</a>
<meta charset="UTF-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
Run code
Cut to clipboard
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="icon" href="/favicon.ico">
<meta name="keywords" content="常用代码">
<meta name="description" content="isWTF's blog!!">
</head>
<body>
</body>
</html>
Run code
Cut to clipboard
$.ajax( {
url: '/index.php?s=/addon/WeiSite/WeiSite/ForgetPassword/tel/'+shoujihao+'/codeddd/'+codeddd+'.html', //这里是静态页的地址
type: "GET", //静态页用get方法,否则服务器会抛出405错误
//dataType: "json",
//cache: false,
//async: false,
beforeSend: function(){
// Handle the beforeSend event
},
success: function(data){
//var result = $(data).find("另一个html页面的指定的一部分").html();
}
});
Run code
Cut to clipboard
<link rel="apple-touch-icon" size="72x72" href="/icon-ipad.png" />
<link rel="apple-touch-icon" size="114x114" href="/icon-iphone4.png" />
<link rel="icon" href="/favicon.ico">
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<meta name="keywords" content="常用代码">
<meta name="description" content="isWTF's blog!!">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
Run code
Cut to clipboard
I('post.id',0,'intval'); // 用intval过滤$_POST['id']
I('get.title','','strip_tags'); // 用strip_tags过滤$_GET['title']
Run code
Cut to clipboard
<meta name="title" content="标题">
<meta name="author" content="作者">
<meta name="description" content="描述">
<meta name="keywords" content="关键字">
<meta name="copyright" content="lizhenqiu.com">
移动端UC /QQ 浏览器的部分私有Meta 属性
下面就说下移动端UC /QQ 浏览器的部分私有Meta 属性,都来自其开发者文档(UC开发者中心,左下一doc文档,QQ浏览器)。
UC 浏览器的部分私有Meta 属性
设置屏幕方向为横屏还是竖屏
<meta name="screen-orientation" content="portrait|landscape">
设置是否全屏,yes表示强制浏览器全屏
<meta name="full-screen" content="yes">
缩放不出滚动条
<meta name="viewport" content="uc-fitscreen=no|yes"/>
设置no后用户缩放与标准浏览器缩放一直,设置为yes后,用户缩放金放到图片和文字,不出现横向滚动条。
排版
<meta name="layoutmode" content="fitscreen|standard" />
fitscreen模式简化页面处理,适合页面阅读节省流量,standard模式和标准浏览器一致;一旦设置layoutmode meta后,用户使用浏览器提供的的排版模式选项将会无效。
夜间模式
<meta name="nightmode" content="enable|disable"/>
nightmode的值设置为disable后,即使用户使用浏览器的夜间模式,页面的表现也仍然是非夜间模式。
强制图片显示
<meta name="imagemode" content="force"/>
UC浏览器为了节省流量,为用户提供了无图模式,但是如果页面的图片是必不可少的,如验证码的,需要强制浏览器显示图片,可以设置imagemode, 不影响子页面。通过META设置图片加载方式会作用于整个页面,如果希望对单个图片进行设置,那么可以使用这个
<img src="..." show="force">
应用模式
<meta name="browsermode" content="application"/>
使用了application这种应用模式后,页面讲默认全屏,禁止长按菜单,禁止收拾,标准排版,以及强制图片显示。
QQ 浏览器x5内核定制标签说明
设置屏幕方向
<meta name="x5-orientation" content="portrait|landscape" />
设置全屏
<meta name="x5-fullscreen" content="true" />
设置屏幕模式
<meta name="x5-page-mode" content="app" />
对于控制全屏的meta 标签,UC 跟QQ 处理的方式稍有不同:区别在于处理系统状态栏,UC 是直接覆盖系统状态栏,而QQ 仍然保留之。
Run code
Cut to clipboard
$("p").css("color","red");
//同时设置字体大小和背景色
$("p").css({"fontSize":"30px" ,"backgroundColor":"#ccc"});
$("button").click(function(){
$("div").animate({
left:'250px',
height:'+=150px',
width:'+=150px'
});
});
Run code
Cut to clipboard
header('Content-Type:text/html;charset=utf-8'); //避免输出乱码
<img title="点击刷新" src="cache/yzm.php" align="absbottom" onclick="this.src='cache/yzm.php?'+Math.random();" />
Run code
Cut to clipboard
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.9.0/jquery.min.js"></script>
<link rel="stylesheet" href="http://lizhenqiu.com/templates/default/style.css" type="text/css" media="screen">
<script type="text/javascript">jQuery(".slideTxtBox").slide(); </script>
Run code
Cut to clipboard
Yourphp手册
简单文本编辑器
data:text/html, <title>Text Editor</title><body contenteditable style="font-size:2rem;font-family:georgia;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;"> lizhenqiu.com
Run code
Cut to clipboard
Chrome提供了一个简单的方法。首先,按“F12”打开控制台,然后输入:
document.designMode = "on"
Run code
Cut to clipboard
添加到收藏夹URL填写下面的即可在当前页面点击收藏夹编辑页面
javascript:(function(){document.designMode = "on" })();
Run code
Cut to clipboard
接下来,你就可以编辑屏幕上的文本内容了。
编辑器
data:text/html, <html contenteditable>
Run code
Cut to clipboard
如果你想找回不小心关闭的Tab页面,只需要同时按下“Control"(Mac用户请按“Command”)、“Shift"和“T”。
js随机数
function getRandom(n){
return Math.floor(Math.random()*n+1)
}
Run code
Cut to clipboard
top.location.href 和 localtion.href 有什么不同
top.location.href=”url”
Run code
Cut to clipboard
在顶层页面打开url(跳出框架)
self.location.href=”url”
Run code
Cut to clipboard
仅在本页面打开url地址
parent.location.href=”url”
Run code
Cut to clipboard
在父窗口打开Url地址
this.location.href=”url”
Run code
Cut to clipboard
用法和self的用法一致
if (top.location == self.location) 判断当前location 是否为顶层来 禁止frame引用 如果页面当中有自定义的frame的话,也可以将parent self top换为自定义frame的名称 效果就是在自定义frame窗口打开url地址
实际中可能这样使用
if(top !== self){ top.location.href = location.href; }
Run code
Cut to clipboard
以下是从网上找到的一个例子,不是很直观, 我加了上面那三行代码, 可以先去掉, 再加上, 看一下效果,就很清楚了 以下是top.htm 代码
<script language=javascript> function rs(){
if(top !== self){ top.location.href = location.href; } parent.left.location.href="top.htm" parent.bot.location.href="top.htm" } < /script> < input type=button name=name value="ksdj" onclick=rs();>
Run code
Cut to clipboard
以下是一个随意文件名的htm文件:
<FRAMESET COLS="150,*"> < FRAME SRC="left.htm" name=left> < FRAMESET ROWS="150,*"> < FRAME SRC="top.htm" name=top> < FRAME SRC="bot.htm" name=bot> < /FRAMESET> < /FRAMESET>
Run code
Cut to clipboard
top表示主窗口,location表示当前窗口,如果你的文件只有一个框架,没有iframe和frmaeset,那么是完全一致的,没有区别。
top.location是在顶层frame中打开新页
window.location是在当前frame中打开新页
parent.location 在当前窗口的父窗口打开Url地址
<select id="isAudit" name="isAudit">
<option value="2">全部</option>
<option value="1" selected = "selected">通过</option>
<option value="0">未通过</option>
</select>
Run code
Cut to clipboard
修改ID增加ID属性,修改class同理
$('.div').attr('id','newid');
如果是给标签添加class样式可以这样
$('#div').addClass('css类名');
strtotime("-1 week"), strtotime("-n days");可以很方便的获取当前日期的前n天、周、月的时间戳
Run code
Cut to clipboard
舒适网页配色方案
px像素转换rem单位工具
(支付宝)给作者钱财以资鼓励 (微信)→
有过 279 条评论 »
htmlshiv.js
<!--[if lt IE 9]> <script src="dist/html5shiv.js"></script> <![endif]-->
selectivizr.js
<!--[if lte IE 8]><script src="js/libs/selectivizr.js"></script><![endif]-->
<html>条件判断注释
<!DOCTYPE html> <!--[if lt IE 7 ]> <html class="ie6 lazy " lang="en"> <![endif]--> <!--[if IE 7 ]> <html class="ie7 lazy " lang="en"> <![endif]--> <!--[if IE 8 ]> <html class="ie8 lazy " lang="en"> <![endif]--> <!--[if IE 9 ]> <html class="ie9 lazy " lang="en"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
这段代码不需要JavaScript,不需要等待JavaScript的加载,你定义的CSS样式会立即生效起作用,没有那种因为加载延迟而出现的样式闪变。
<style> .m{background: url(https://out.img.pan.lizhenqiu.com/Fru0NMubSI53GXxWAYULNkKKnVXK) no-repeat center; width: 138px; height: 138px;} .m:hover { background: url(https://out.img.pan.lizhenqiu.com/Fj7uYEVHH5bw-guO6lBYQEnOGyEP) no-repeat center; } .h{background: url(https://out.img.pan.lizhenqiu.com/FnvTqj5e3SiIHAYZHi9t9U2KIvon) no-repeat center; width: 138px; height: 138px; }.h:hover { background: url(https://out.img.pan.lizhenqiu.com/Fq1sOrW-GrE8H7bK-2IGt10kg-UK) no-repeat center; } </style> <div class="m"></div><div class="h"></div>
天猫 淘宝 京东等电商 双十一 11.11光棍节 购物节日 背景平铺 抢红包 ad 广告 素材 js html源码css特效
<style>#adRight_11 .right_box { display: block; width: 460px; height: 1080px; overflow: hidden; position: absolute; left: 0; top: 0; background: #fff; }#adLeft_11 .left_box { display: block; width: 460px; height: 1080px; overflow: hidden; position: absolute; right: 0; top: 0; background: #fff; } #adLeft_11 .left_box a, #adRight_11 .right_box a { display: block; float: left; width: 138px; height: 138px; background: url(https://out.img.pan.lizhenqiu.com/Fllim5n1OKv1Y_FObxVQR90Lzl8l) no-repeat; }#adLeft_11 .left_box a:hover, #adRight_11 .right_box a:hover { background-position: 0 -138px; } </style> <div class="news_box" style=" width: 900px;height: 1000px;margin: auto;background: green;position: relative;z-index: 99;"> 正文内容 </div> <script type="text/javascript" src="https://lizhenqiu.com/templates/default/jquery.min.js"></script> <script>// 双11广告 $(function(){ if($(".news_box").length > 0){ var adLeft = document.createElement("div"); adLeft.id = "adLeft_11"; var adRight = document.createElement("div"); adRight.id = "adRight_11"; var adHtml = ""; for(var i=0;i<25;i++){ adHtml +='<a href="http://lizhenqiu.com/" target="_blank"></a>'; }; $(adLeft).html('<div class="left_box">'+adHtml+'</div>'); $(adRight).html('<div class="right_box">'+adHtml+'</div>'); $(".news_box").after($(adLeft)).after($(adRight)); }; function resize(){ // 背景图 var oWLength = $(window).width(); var oAlength = parseInt((oWLength - 1000)/2); $("#adLeft_11,#adRight_11").css('width',oAlength+'px'); }; resize(); window.onresize = function(){ resize(); }; $(window).scroll(function () { var scrolltoph = $(window).scrollTop(); var offTop = 0;//$("#navim").offset().top + 45 +'px'; if (scrolltoph > 187) { $("#adLeft_11,#adRight_11").css('top','0px'); } else { $("#adLeft_11,#adRight_11").css('top',offTop); } }); })</script>
在网页设计中,Sticky footers设计是最古老和最常见的效果之一,大多数人都曾经经历过。它可以概括如下:如果页面内容不够长的时候,页脚块粘贴在视窗底部;如果内容足够长时,页脚块会被内容向下推送。
方法一 :fixed
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>sticky footer</title> <style type="text/css"> *{padding: 0;margin: 0;font-size: 48px} /* 第一步设置盒子为满屏大小 */ .box{ position: fixed; width: 100%; height: 100%; top: 0; left: 0; overflow: auto; background: green; } /* 第二步子盒子设置最小高度且清除浮动 给一个padding-bottom 等于footer 避免内容被footer遮盖*/ .box .main{ width: 100%; min-height: 100%; padding-bottom: 100px; } .box .main .content{ background: orange; /*padding-bottom: 100px;*/ } /* 第三步footer的高度和margin-top要相等 */ .box .footer{ position: relative; width: 100%; height: 100px; background: #f3f3f3; margin: -100px auto 0 auto; clear: both; text-align: center; line-height: 100px; } .clearfix{ display: inline-block; } .clearfix::after{ content: "."; display: block; height: 0; line-height: 0; visibility: hidden; clear: both; } </style> </head> <body> <div class="box"> <div class="main clearfix"> <div class="content"> <p>这里是内容区域</p> <p>这里是内容区域</p> <p>这里是内容区域</p> <p>这里是内容区域</p> <p>这里是内容区域</p> <p>这里是内容区域</p> <p>这里是内容区域</p> </div> </div> <div class="footer">这是footer区域</div> </div> </body> </html>
方法二,flexbox
<html> <head> <style> body { display: flex; flex-flow: column; min-height: 100vh; } main{flex:1} header,footer{height:80px;} </style> </head> <body> <header> <h1>Site name</h1> </header> <main> <p>Bacon Ipsum dolor sit amet... <!-- Filler text from baconipsum.com --> </p> </main> <footer> <p> © 2015 No rights reserved.</p> <p>Made with ♥ by an anonymous pastafarian.</p> </footer> </body> </html>
我们需要在页头和页脚设置高度,但其内容的高度自动伸缩的来适配剩余空间。我们可以在<main>上设置flex值大于0(常用的是1)
flex属性是flex-grow、flex-shrink和flex-basis三个属性缩写。任何元素设置了flex大于0,元素就会灵活的控制自己的尺寸,来适配容器的剩余空间。例如,如果<main>设置了flex:2,<footer>设置了flex:1,那么页脚的高度是主内容高度的二分之一,同样的,如果值设置的是4和2而不是2和1,他们效果是一样的,因为他们的倍数比例值一样。
function scrollToEnd(){//滚动到底部 var h = $(document).height()-$(window).height(); $(document).scrollTop(h); }
格式:border-top-left-radius:水平角半径/垂直角半径;
原因:图片文字等inline元素默许是跟父级元素的baseline对齐,而baseline又和父级底边有必定间距
解决方案 就是可以在image那里设置
vertical-align:top/bottom/text-top/text-bottom
<object type="application/x-shockwave-flash" style="outline:none;" data="https://out.img.pan.lizhenqiu.com/9ce05d9d5af892d8a48c626ce4b1ce7f" width="180" height="135"><param name="movie" value="https://out.img.pan.lizhenqiu.com/9ce05d9d5af892d8a48c626ce4b1ce7f"></param><param name="AllowScriptAccess" value="always"></param><param name="wmode" value="opaque"></param></object>
abowman SWiX SWF编辑工具
单行文本溢出隐藏
p{ width:200px;white-space: nowrap;overflow: hidden; text-overflow: ellipsis; }
指定行数、多行溢出隐藏(兼容ie7)
div { heigh:60px;line-height:20px;overflow : hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;}
itunes清楚视频库记录
删除电脑中iTunes的影片记录
找到itunes library文件 删掉就可以了
iTunes Library.itl