常用html、demo代码
发布时间:2015-10-15, 14:45:06 分类:HTML | 编辑 off 网址 | 辅助
图集1/30
正文 9756字数 27,225,081阅读
暗网网址导航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 条评论 »
var winWidth = 0; var winHeight = 0; function findDimensions() //函数:获取尺寸 { //获取窗口宽度 if (window.innerWidth) winWidth = window.innerWidth; else if ((document.body) && (document.body.clientWidth)) winWidth = document.body.clientWidth; //获取窗口高度 if (window.innerHeight) winHeight = window.innerHeight; else if ((document.body) && (document.body.clientHeight)) winHeight = document.body.clientHeight; //通过深入Document内部对body进行检测,获取窗口大小 if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { winHeight = document.documentElement.clientHeight; winWidth = document.documentElement.clientWidth; } //结果输出至两个文本框 (在这里对获取到的参数进一步使用) document.form1.availHeight.value= winHeight; document.form1.availWidth.value= winWidth; } findDimensions(); //调用函数,获取数值 window.onresize=findDimensions;
<style> html,body,div,ul,li { padding:0; margin:0; } ul,li,ol { list-style:none; } .box { position:relative; width:600px; height:300px; margin:20px auto; } .picture { width:600px; height:300px; overflow:hidden; position:absolute; } .picture ul { position:absolute; width:2400px; height:300px; } .picture ul li { float:left; width:600px; height:300px; } .control { position:absolute; bottom:0px; left:450px; } .control li { cursor:pointer; float:left; width:20px; height:20px; text-align:center; line-height:20px; background:lightblue; margin:4px; border-radius:5px } .control .active { background:yellow; } </style> <div class="box" id="box"> <div class="picture"> <ul id="picture"> <li><img src="http://www.jq22.com/img/cs/500x300-1.png" width="600px" height="300px"></li> <li><img src="http://www.jq22.com/img/cs/500x300-2.png" width="600px" height="300px"></li> <li><img src="http://www.jq22.com/img/cs/500x300-3.png" width="600px" height="300px"></li> <li><img src="http://www.jq22.com/img/cs/500x300-1.png" width="600px" height="300px"></li> </ul> </div> <ol class="control" id="control"> <li class="active">1</li> <li>2</li> <li>3</li> </ol> </div> <script> var box = document.getElementById("box"); var picture = document.getElementById("picture").children; var control = document.getElementById("control").children; var ul = document.getElementById("picture"); for (var i = 0; i < control.length; i++) { control[i].index = i; control[i].onclick = function() { for (var j = 0; j < control.length; j++) { control[j].className = ""; } this.className = "active"; animate(ul, -this.index * 600, 10); } } var k = 0; function autoPlay() { k++; if (k > control.length) { ul.style.left = 0 + "px"; k = 1; } animate(ul, -k * 600, 10); for (var i = 0; i < control.length; i++) { control[i].className = ""; } var index = k % control.length; control[index].className = "active"; } var tim = setInterval(autoPlay, 2000); box.onmouseover = function() { clearInterval(tim); } box.onmouseout = function() { tim = setInterval(autoPlay, 2000); } function animate(ele, target, ms) { clearInterval(ele.timer); //方便清除本元素上一次的定时器操作 ele.timer = setInterval(function() { //判断目标元素是向左或者向右() var step = ele.offsetLeft < target ? 10 : -10; var result = Math.abs(target - ele.offsetLeft); /*到动画最后移动步长时*/ if (result < 10) { clearInterval(ele.timer); ele.style.left = target + 'px'; } else { //向目标元素发生位移。 ele.style.left = ele.offsetLeft + step + 'px'; } }, ms); } </script>
<style>* { padding:0; margin:0; list-style:none; } .banner { width:640px; height:300px; overflow:hidden; margin:0 auto; } .inner { width:9999px; position:relative; animation:aaa 16s infinite 2s running; } @keyframes aaa { 0% { transform:translateX(0px); } 5% { transform:translateX(-640px); } 25% { transform:translateX(-640px); } 30% { transform:translateX(-1280px); } 50% { transform:translateX(-1280px); } 55% { transform:translateX(-1920px); } 75% { transform:translateX(-1920px); } 80% { transform:translateX(-2560px); } 100% { transform:translateX(-2560px); } }.inner:hover { animation-play-state:paused; cursor:pointer; } .innerwrapper { float:left; width:640pxpx; } .banner img { width:640px; height:300px; } </style> <div class="banner"> <div class="inner"> <div class="innerwrapper"><img src="http://www.jq22.com/img/cs/500x500-1.png" alt="banner1"></div> <div class="innerwrapper"><img src="http://www.jq22.com/img/cs/500x300-1.png" alt="banner2"></div> <div class="innerwrapper"><img src="http://www.jq22.com/img/cs/300x500-1.png" alt="banner3"></div> <div class="innerwrapper"><img src="http://www.jq22.com/img/cs/500x500-2.png" alt="banner4"></div> <div class="innerwrapper"><img src="http://www.jq22.com/img/cs/500x500-1.png" alt="banner1"></div> </div> </div>
<style>#box { margin:50px auto; padding:2px; background-color:#ebebeb; } #title { text-align:left; font-weight:bold; font-size:12px; } input[type="button"] { width:60px; height:45px; line-height:20px; text-align:center; } .num { border:0px; background-color:#fafafa; } .symbol { background-color:#f3f3f3; border:0px; } #zhi { height:40px; width:250px; text-align:right; border:0px; background-color:#ebebeb; font-size:30px; font-weight:bold; } #count { height:20px; width:250px; text-align:right; border:0px; background-color:#ebebeb; } </style><table id="box"> <tbody><tr id="title"> <td colspan="4">计算器</td> </tr> <tr> <td colspan="4"><input type="text" id="count"></td> </tr> <tr> <td colspan="4"><input type="text" id="zhi"></td> </tr> <tr> <td><input type="button" id="CE" value="CE" class="symbol" onclick="CE()"></td> <td><input type="button" id="C" value="C" class="symbol" onclick="returnToZero()"></td> <td><input type="button" id="delete" value="←" class="symbol" onclick="delete1()"></td> <td><input type="button" id="except" value="/" class="symbol" onclick="look(this.value)"></td> </tr> <tr> <td><input type="button" id="num7" value="7" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num8" value="8" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num9" value="9" class="num" onclick="display(this.value)"></td> <td><input type="button" id="cheng" value="*" class="symbol" onclick="look(this.value)"></td> </tr> <tr> <td><input type="button" id="num4" value="4" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num5" value="5" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num6" value="6" class="num" onclick="display(this.value)"></td> <td><input type="button" id="add" value="+" class="symbol" onclick="look(this.value)"></td> </tr> <tr> <td><input type="button" id="num1" value="1" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num2" value="2" class="num" onclick="display(this.value)"></td> <td><input type="button" id="num3" value="3" class="num" onclick="display(this.value)"></td> <td><input type="button" id="minus" value="-" class="symbol" onclick="look(this.value)"></td> </tr> <tr> <td><input type="button" value="±" class="symbol" onclick="contrary()"></td> <td><input type="button" id="num0" value="0" class="num" onclick="display(this.value)"></td> <td><input type="button" id="point" value="." class="symbol" onclick="look(this.value)"></td> <td><input type="button" id="equal" value="=" class="symbol" onclick="start()"></td> </tr> </tbody></table> <script> //显示数字 function display(value) { var zhi = document.getElementById("zhi"); var count = document.getElementById("count"); var countValue = count.value; var symbol = countValue.substring(countValue.length - 1); var value = value; //点击事件触发放回的value值赋值给变量value if (equal == 1) //点击=,*,/,-,+与后,再次点击先归零,再传值 { zhi.value = ""; zhi.value += value; equal = 0; } else if (zhi.value == "0") { zhi.value = value; } else { zhi.value += value; } } //点击+,-,*,时,count的显示 function look(value) { var zhi = document.getElementById("zhi"); var count = document.getElementById("count"); var value = value; count.value += zhi.value + value; equal = 1; } //计算 function start() { var zhi = document.getElementById("zhi"); var count = document.getElementById("count"); var value = count.value + zhi.value; var return1 = eval("(" + value + ")"); document.getElementById("count").value = ""; zhi.value = return1; equal = 1; } //归零 function returnToZero() { document.getElementById("zhi").value = "0"; document.getElementById("count").value = ""; } //Backspace function delete1() { var zhi = document.getElementById("zhi"); var value = zhi.value; var return1 = value.substr(0, value.length - 1); zhi.value = return1; } //CE function CE() { document.getElementById("zhi").value = 0; } //contrary取相反数 function contrary() { var zhi = document.getElementById("zhi"); var value = zhi.value; zhi.value = parseInt(value * (-1)); }</script>
<select name="nian" id="nian"></select>年 <select name="nian" id="yue"></select>月 <select name="nian" id="ri"></select>日 <script>$(function() { var mydate = new Date(); var nian = mydate.getFullYear(); var yue = mydate.getMonth() + 1; for (var i = nian; i > 1900; i--) { var html_nian = '<option value="' + i + '">' + i + '</option>'; $('#nian').append(html_nian); } for (var ii = 1; ii <= 12; ii++) { var html_yue = '<option value="' + ii + '">' + ii + '</option>'; $('#yue').append(html_yue); } $('#nian').change(function() { my_ri($('#nian').val(), $('#yue').val()) }); $('#yue').change(function() { my_ri($('#nian').val(), $('#yue').val()) }); }) function my_ri(n, y, r) { if (n > 0 && y > 0) { $('#ri').html(''); var mydate_ri = new Date(n, y, 0); var ri = mydate_ri.getDate(); for (var iii = 1; iii <= ri; iii++) { var html_ri = '<option value="' + iii + '">' + iii + '</option>'; $('#ri').append(html_ri); } $.each($('#nian').find('option'), function(i) { if ($('#nian').find('option').eq(i).attr('value') == n) { $('#nian').find('option').eq(i).attr('selected', 'selected') } }) $.each($('#yue').find('option'), function(i) { if ($('#yue').find('option').eq(i).attr('value') == y) { $('#yue').find('option').eq(i).attr('selected', 'selected') } }) $.each($('#ri').find('option'), function(i) { if ($('#ri').find('option').eq(i).attr('value') == r) { $('#ri').find('option').eq(i).attr('selected', 'selected') } }) } }</script>
<style>body { width: 100%; height: 100%; position: fixed; background-color: #34495e; } .content { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); height: 160px; overflow: hidden; font-family: 'Lato', sans-serif; font-size: 35px; line-height: 40px; color: #ecf0f1; } .content__container { font-weight: 600; overflow: hidden; height: 40px; padding: 0 40px; } .content__container:before { content: '['; left: 0; } .content__container:after { content: ']'; position: absolute; right: 0; } .content__container:after, .content__container:before { position: absolute; top: 0; color: #16a085; font-size: 42px; line-height: 40px; -webkit-animation-name: opacity; -webkit-animation-duration: 2s; -webkit-animation-iteration-count: infinite; animation-name: opacity; animation-duration: 2s; animation-iteration-count: infinite; } .content__container__text { display: inline; float: left; margin: 0; } .content__container__list { margin-top: 0; padding-left: 110px; text-align: left; list-style: none; -webkit-animation-name: change; -webkit-animation-duration: 10s; -webkit-animation-iteration-count: infinite; animation-name: change; animation-duration: 10s; animation-iteration-count: infinite; } .content__container__list__item { line-height: 40px; margin: 0; } @-webkit-keyframes opacity { 0%, 100% { opacity: 0; } 50% { opacity: 1; } } @-webkit-keyframes change { 0%, 12.66%, 100% { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } 16.66%, 29.32% { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } 33.32%,45.98% { -webkit-transform: translate3d(0, -50%, 0); transform: translate3d(0, -50%, 0); } 49.98%,62.64% { -webkit-transform: translate3d(0, -75%, 0); transform: translate3d(0, -75%, 0); } 66.64%,79.3% { -webkit-transform: translate3d(0, -50%, 0); transform: translate3d(0, -50%, 0); } 83.3%,95.96% { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } } @keyframes opacity { 0%, 100% { opacity: 0; } 50% { opacity: 1; } } @keyframes change { 0%, 12.66%, 100% { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } 16.66%, 29.32% { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } 33.32%,45.98% { -webkit-transform: translate3d(0, -50%, 0); transform: translate3d(0, -50%, 0); } 49.98%,62.64% { -webkit-transform: translate3d(0, -75%, 0); transform: translate3d(0, -75%, 0); } 66.64%,79.3% { -webkit-transform: translate3d(0, -50%, 0); transform: translate3d(0, -50%, 0); } 83.3%,95.96% { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } } </style> <div class="content"> <div class="content__container"> <p class="content__container__text"> Hello </p> <ul class="content__container__list"> <li class="content__container__list__item">world !</li> <li class="content__container__list__item">bob !</li> <li class="content__container__list__item">users !</li> <li class="content__container__list__item">everybody !</li> </ul> </div> </div>
<span id="span1"></span> <br><span id="span2"></span><br> <div id="div1" style="background-color: Green; border: 1px solid red; height: 100px; top: 100px; left: 100px; width: 100px; position: absolute;" onmousedown="mouseDown(this,event)" onmousemove="mouseMove(event)" onmouseup="mouseUp(event)"> </div> <script> var mouseX, mouseY; var objX, objY; var isDowm = false; //是否按下鼠标 function mouseDown(obj, e) { obj.style.cursor = "move"; objX = div1.style.left; objY = div1.style.top; mouseX = e.clientX; mouseY = e.clientY; isDowm = true; } function mouseMove(e) { var div = document.getElementById("div1"); var x = e.clientX; var y = e.clientY; if (isDowm) { div.style.left = parseInt(objX) + parseInt(x) - parseInt(mouseX) + "px"; div.style.top = parseInt(objY) + parseInt(y) - parseInt(mouseY) + "px"; document.getElementById("span1").innerHTML = "x:" + div.style.top + " " + "y:" + div.style.left; } } function mouseUp(e) { if (isDowm) { var x = e.clientX; var y = e.clientY; var div = document.getElementById("div1"); div.style.left = (parseInt(x) - parseInt(mouseX) + parseInt(objX)) + "px"; div.style.top = (parseInt(y) - parseInt(mouseY) + parseInt(objY)) + "px"; document.getElementById("span2").innerHTML = "x:" + div.style.top + " " + "y:" + div.style.left; mouseX = x; rewmouseY = y; div1.style.cursor = "default"; isDowm = false; } }</script>
加载页面等待界面 css3
<style>body { display:flex; font-size:2rem; overflow:hidden; } .Box { position:absolute; width:100vw; height:100vh; background-color:#fff; filter:blur(4vmin) contrast(100); } .BigCircle,.SmallCircle { position:absolute; top:50%; left:50%; background-color:#000; } .BigCircle { width:30vmin; height:30vmin; margin:-15vmin; border-radius:50%; } .SmallCircle { width:15vmin; height:15vmin; margin:-7.5vmin; background-color:#000; border-radius:50%; animation:move 1.5s infinite alternate cubic-bezier(0.18,0,0.26,1); } .SmallCircle:nth-child(1) { --degree:0deg; animation-delay:0s; background-color:red; } .SmallCircle:nth-child(2) { --degree:45deg; animation-delay:-0.375s; background-color:#ffbf00; } .SmallCircle:nth-child(3) { --degree:90deg; animation-delay:-0.75s; background-color:#80ff00; } .SmallCircle:nth-child(4) { --degree:135deg; animation-delay:-1.125s; background-color:#00ff40; } .SmallCircle:nth-child(5) { --degree:180deg; animation-delay:-1.5s; background-color:cyan; } .SmallCircle:nth-child(6) { --degree:225deg; animation-delay:-1.875s; background-color:#0040ff; } .SmallCircle:nth-child(7) { --degree:270deg; animation-delay:-2.25s; background-color:#8000ff; } .SmallCircle:nth-child(8) { --degree:315deg; animation-delay:-2.625s; background-color:#ff00bf; } .SmallCircle:nth-child(9) { --degree:360deg; animation-delay:-3s; background-color:red; } @keyframes move { 0% { transform:rotate(var(--degree)) translateY(0); } 70%,100% { transform:rotate(var(--degree)) translateY(-30vmin); } }</style><div class="Box"> <div class="BigCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> <div class="SmallCircle"></div> </div>
$(".select").change(function(){ console.log($(this).val()) }); //操作被选中的元素
JavaScript获得获取input元素value值
<html> <head> <script language="javascript"> function print(){ var a=myform.name.value; alert(a); } </script> </head> <body> <form name="myform"> <input type="text" name="name" id="nn" /> <input type="button" name="button" value="获取" onclick="print()" /> </form> </body> </html>
<html> <head> <script language="javascript"> function print(){ var a=document.getElementById("nn").value; alert(a); } </script> </head> <body> <form> <input type="text" name="name" id="nn" /> <input type="button" name="button" value="获取" onclick="print()" /> </form> </body> </html>
$where['name'] = array('like', '%thinkphp%'); $where['title'] = array('like','%thinkphp%'); $where['_logic'] = 'or'; $map['_complex'] = $where; $map['id'] = array('gt',1);
查询条件是
( id > 1) AND ( ( name like '%thinkphp%') OR ( title like '%thinkphp%') )
//获取文章列表 public function new_list($classname,$cid,$p,$m,$img,$k,$hyid){ $where[$classname]=$cid; $where['hyfl']=array('like','%,'.$cid.',%'); $where['_logic'] = 'or'; $w['_complex'] = $where; if($img) $w['imgurl']=array('neq',''); if($k) $w['title']=array('like','%'.$k.'%'); if($hyid) $w['gz_headeryjhhyy']=$hyid; $w['displaytype']=1; $p=$p+0; if($p<0) $p=0; $n=$p*$m; if($p>0) $n=($p-1)*$m; //dump($w);exit; $l=M('news')->where($w)->order('com_ok desc,no_order asc,id desc')->limit($n,$m)->select(); //print_r($l);exit(); return $l; }