Welcom to 评论 - lizhenqiu blog!
#951
#952
1. 获取元素方法 1.根据 id var element = document.getElementById("idName"); 2.根据 标签名 var elements = document.getElementsByTagName("标签名"); 3.根据 类名 var elements = document.getElementsByClassName("类名"); 4.H5新增 获取方法 document.queryselector(""); document.queryselectorAll(""); 5.获取 body 元素 document.body 2. 事件 1.点击事件(双击事件ondblclick) ele.onclick = function(){}; 2.鼠标事件 1.鼠标悬浮(经过) ele.onmouseover = function(){}; 2.鼠标离开 ele.onmouseout = function(){}; onmouseenter和onmouseleave是DOM2的方法, 有兼容问题 onmouseover 鼠标经过盒子的时候执行1次 onmousemove 鼠标只要移动的时候就会执行 3.鼠标按下 ele.onmousedown = function(){}; 4.鼠标弹起 ele.onmouseup = function(){}; 5.鼠标滚动 ele.onmousewheel = function(){}; 3.焦点事件 1.失去焦点 ele.onblur = function(){}; 2.获得焦点 ele.onfocus = function(){}; 3.输入事件 ele.oninput = function(){}; onkeyup和oninput 联想搜索 4.内容发生改变 ele.onchange = function(){}; 一般做验证或者下拉框选择会使用onchange 4.键盘事件 1.键盘键入 ele.onkeydown = function(){}; 2.键盘弹起 ele.onkeyup = function(){}; 3.键盘按下 ele.onleypress = function(){}; onkeydown优先于onkeypress执行 onkeypress不识别系统按键 onkeypress区分大小写 5.window 事件 1.键盘事件 event.keyCode 键盘对应的编码 2.页面滚动 window.onscroll = function(){}; window.scroll必须有滚动条才触发, 一般配合$(window).scrollTop() window.onmousewheel / document.onmousewheel无论有没有滚动条都能触发 3.窗口大小变化 window.onresize = function(){}; 3. 字符串 相关方法 1.replace() 字符串替换 xxx = xxx.replace(searchValue, replaceValue); 只找第一个匹配的替换 2.indexOf() --- lastIndexOf() 搜索(找到 对应的 返回位置) 一个参数从第一个找 两个参数从指定的位置找 不存在返回 -1, 查找的是""返回 0 3.trim() 删除左右空格 4.split("") 字符串 转换成 数组 引号里确定用什么分割 5.charAt() 获取指定位置处字符 6.slice() 从start位置开始,截取到end位置,end取不到 7.substring() 从start位置开始,截取到end位置,end取不到 8.substr() 从start位置开始,截取length个字符 9.toUpperCase() str转换为大写 10.toLowerCase() str转换为小写 4.数组 相关方法 1.join("") 数组 转换成 字符串 引号里确定用什么拼接(默认逗号) 2.toString() 数组 转换为 字符串 (去掉[]) 3.valueOf() 返回数组对象本身 4.Array.isArray(xxx) 检测xxx是否是数组 5.xxx instanceOf Array 检测xxx是否是数组 6.push() pop() 从后边增删 7.unshift() shift() 从前边增删 8.reverse() 翻转数组 9.slice() 从数组中截取一部分内容 10.splice() 从数组中删除或替换数组中的一部分 11. xxx.indexOf() 寻找指定元素在数组中的位置,如果没找到返回-1 12. xxx.lastIndexOf() 从后面找 13.xxx.filter(function(){ }) 迭代过滤/筛选 14.xxx.forEach(function(){ }) 遍历 15.xxx.map(function(){ }) 映射 16.xxx.some(function(){ }) 数组中至少有一个数据符合要求 17.xxx.every(function(){ }) 数组中所有数据符合要求 18.concat() 把一个数组和另一个数组拼接在一起 19.sort() 进行冒泡排序 b-a倒序 a-b升序
#953
<style> embed{font-size: 25px;height: 25px;} </style>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> table{ height: 50px; background: #000; color: white; font-size: 25px; } </style><style> embed{font-size: 25px;height: 25px;line-height:25px;} </style> <body> <table width="100%"> <tr> <th> <embed src="http://23.105.205.22/search.svg" type="image/svg+xml" /> </th> </tr> </table> </body> </html>
#954
<html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:0px; height:0px; border-left:10px solid transparent; border-top:10px solid transparent; border-bottom:10px solid transparent; border-right:10px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:10px; height:10px; border-left:50px solid #432a23; border-top:50px solid #38a578; border-bottom:50px solid #38c7c7; border-right:50px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
#955
<!DOCTYPE html> <html onselectstart="return false"> <head lang="en" > <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } li{ list-style: none; } #main{ width: 300px; height: 300px; left: 50%; top: 50%; position: absolute; background: antiquewhite; } #main-top{ width: 300px; height: 50px; background: #c7cecd; cursor: move; } </style> </head> <body> <div id="main"> <div id="main-top">拖拽我</div> <div id="main-bottom"></div> </div> <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script> <script> $(function(){ var main=$("#main"); var box=$('#main-top'); var offx=0; var offy=0; var mainw=main.width(); var mainh=main.height(); //鼠标按下 box.mousedown(function(ev){ var ev=ev||window.event; //算出点击内容 里面的位置 offx=ev.pageX-main.offset().left; offy=ev.pageY-main.offset().top; //按下过程中 $(document).bind("mousemove",function(ev){ var ev=ev||window.event; //isdraging=true; //当前鼠标的位置 var mousex= ev.pageX; var mousey= ev.pageY; // 动态算出盒子距离屏幕边缘的距离 var xinx=mousex-offx; var xiny=mousey-offy; //可视区宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; //算出盒子边缘距离屏幕的距离 var maxx=pagewidth-mainw; var maxy=pageheight-mainh; //xinx>0 并且 xinx<(页面最大宽度 - 浮层的宽度) //xiny>0 并且 xiny<(页面最大宽度 -浮层的高度) xinx=Math.min(maxx,Math.max(0,xinx)); xiny=Math.min(maxy,Math.max(0,xiny)); // 盒子的偏移量 main.css({left:xinx+"px"}) main.css({top:xiny+"px"}) }) }) //抬起 $(document).mouseup(function(){ $(this).unbind('mousemove'); }) }) </script> </body> </html>
#956
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{margin:0;padding:0} #main{ position: absolute; width: 260px; height: 260px; background: antiquewhite; top: 0; left: 0; } #con{ width: 100%; height: 30px; background: aquamarine; cursor: move; } </style> </head> <body> <div id='main'> <div id='con'>拖动我</div> </div> <script> function $(id){return document.getElementById(id);} // 居中浮层 function aurocenter(el){ // 可视区宽高 var bodyw=document.documentElement.clientWidth; var bodyh=document.documentElement.clientHeight; var elw=el.offsetWidth; var elh=el.offsetHeight; el.style.left=(bodyw-elw)/2+'px'; el.style.top=(bodyh-elh)/2+'px'; } aurocenter($('main')) var offx=0; var offy=0; var tuodong=false; //判断是否可拖动 // 鼠标按下 $('con').addEventListener('mousedown',function(ev){ var ev=ev||window.event; // 算出点击内容 里面的位置 offx= ev.pageX-$('main').offsetLeft; offy= ev.pageY-$('main').offsetTop; tuodong=true; }) // 鼠标移动 document.onmousemove=function(ev){ var ev=ev||window.event; // 鼠标当前位置 var mousex=ev.pageX; var mousey=ev.pageY; var movex=0; var movey=0; if (tuodong===true){ // 计算出盒子距离屏幕边缘的距离 movex=mousex-offx; movey=mousey-offy; // 获取可视区的宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; // 获取大盒子的宽高 var dalogW=$('main').offsetWidth; var dalogH=$('main').offsetHeight; // 算出盒子边缘距离 屏幕边缘的距离 var maxx=pagewidth-dalogW; var maxy=pageheight-dalogH; // movex>0 并且 movex<(页面最大宽度 - 浮层的宽度) movex=Math.min(maxx, Math.max(0,movex)) movey=Math.min(maxy, Math.max(0,movey)) // 盒子偏移量 $('main').style.left=movex+'px'; $('main').style.top=movey+'px'; } } // 鼠标松开 document.onmouseup=function(){ tuodong=false; } window.onresize=function(){ aurocenter($('main')); } </script> </body> </html>
#957
$("body").animate({"scrollTop":top})
$("html,body").animate({"scrollTop":top})
#958
<script> //网页当前状态判断 var hidden, state, visibilityChange,otitle; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; state = "visibilityState"; } else if (typeof document.mozHidden !== "undefined") { hidden = "mozHidden"; visibilityChange = "mozvisibilitychange"; state = "mozVisibilityState"; } else if (typeof document.msHidden !== "undefined") { hidden = "msHidden"; visibilityChange = "msvisibilitychange"; state = "msVisibilityState"; } else if (typeof document.webkitHidden !== "undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; state = "webkitVisibilityState"; } otitle=document.title; // 添加监听器,在title里显示状态变化 document.addEventListener(visibilityChange, function() { //document.title = document[state]; //console.log(document.visibilityState); if(document.visibilityState=='hidden') document.title = '(;°○° ) (x___x) 被离开';//(昏倒) // 被离开 // '+otitle; else document.title = otitle; }, false); //初始化页面状态 //document.title = document[state]; /*var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null; var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange'); var onVisibilityChange = function(){ if (!document[hiddenProperty]) { // console.log('页面非激活'); }else{ document.title ='页面非激活'; //console.log('页面激活') } } document.addEventListener(visibilityChangeEvent, onVisibilityChange);*/ </script>
#959
<!-- uppu upuu. .upuuuuup. . .uppuppuuuuppppyup uuuyuuypyyupuupyuuuu uupuynnnnnnnpuupuuuu uupppunnnnnnnypupuuu uuuyunnnnnnnnnnyuu. uuuuyyypyynnnuyyupu uuupppp. pynnpppuu. uuuppp. puuupupuu uuuupuyu .pupuuuuu uuuu puuy .puuuuu. uuuuuynnnu .uuuuu y..pppuuyunnuu uuuu. .pu.nu.nyyyuy uuuu yn..yyny...p uuuu u...n.ny.... yuuuu y....nuuupypyyunnn un.unn.yppuunnynunnn un..nynnpuupppu...np. .uu.nyunyuuuuuuup.n.n. yn...nuuuypppupuuunnuu pp..conuuyypyyyypupnny unnucoonuuypuupuuyyuypy n.npuconyyyppyppyyu.... ... ycupupppppuy.cc.nyu uu pyupuupupp.occ.nuy uuuuppypupup u.uuu uuuuuuuuuu yyy ..uyppuuuuu .upncccccccc.y .uuuuuucccccnypuuuuuu.. .uuuuuuup....upuuuuuuuuuuuuuu. .uuuuuuuuu. .uuuppuuuuuuuuuuuu uuuuuuuuu ..upuppp uuuuuuu. uuppy uuuuuuu ppupu upuuupp. puuuu upppyup. pupu .upupyp .puu upupyy pup upuuu uup .upu .pp .uuuu ppu upupu puu. pppp uuuuu. uuuu .uuuuuuu.. .pppp .. .... .pppp. -->
#960
#961
<script> var str = '<iframe frameborder="0" width="640" height="498" src="https://v.qq.com/iframe/player.html?vid=b0516dp12du&tiny=0&auto=0" allowfullscreen></iframe>'; alert(str.match(/<iframe .*?src=\"(.+?)\"/)[1]);</script>
#962
//获取视频数据的地址 ,getMovieUrl:URL+"php/getMovie.php" //视频数据获取地址 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义 , toolbars: [["fullscreen","source","undo","redo","insertunorderedlist","insertorderedlist","unlink","link","cleardoc","selectall","print","searchreplace","preview","help","insertimage","snapscreen","emotion","horizontal","anchor","spechars","blockquote","insertcode","bold","italic","underline","strikethrough","forecolor","backcolor","superscript","subscript","justifyleft","justifycenter","justifyright","justifyjustify","touppercase","tolowercase","directionalityltr","directionalityrtl","indent","removeformat","formatmatch","autotypeset","customstyle","paragraph","rowspacingbottom","rowspacingtop","lineheight","fontfamily","fontsize","imagenone","imageleft","imageright","imagecenter","inserttable","deletetable","mergeright","mergedown","splittorows","splittocols","splittocells","mergecells","insertcol","insertrow","deletecol","deleterow","insertparagraphbeforetable","insertframe"]] //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
#963
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="../internal.js"></script> <style type="text/css"> .warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;} #url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; } .format span{display: inline-block; width: 58px;text-align: center; zoom:1;} table td{padding:5px 0;} #align{width: 65px;height: 23px;line-height: 22px;} </style> </head> <body> <div class="warp"> <table width="300" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" class="format"> <span style=" width: auto; ">填写复制通用代码</span><!-- <var id="lang_input_address"></var> --> <!-- <input style="width:200px" id="url" type="text" value=""/> --> <textarea style=" width: 100%; height: 119px; " id="url" ></textarea> </td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td> </tr> <tr style="display:none;"> <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td> <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td> </tr> <tr style="display:none;"> <td colspan="2"><span><var id="lang_input_alignMode"></var></span> <select id="align"> <option value=""></option> <option value="left"></option> <option value="right"></option> </select> </td> </tr> </table> </div> <script type="text/javascript"> var iframe = editor._iframe; if(iframe){ $G("url").value = iframe.getAttribute("src")||""; var str = $G("url").value; $G("url").value = (str.match(/<iframe .*?src=\"(.+?)\"/)[1]); $G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||""; $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||""; $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false; $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false; $G("align").value = iframe.align ? iframe.align : ""; } function queding(){ var url = ($G("url").value.match(/<iframe .*?src=\"(.+?)\"/)[1]),//$G("url").value.replace(/^\s*|\s*$/ig,""), width = '100%',//$G("width").value, height = '300',//$G("height").value, scroll = $G("scroll"), frameborder = $G("frameborder"), //float = $G("align").value, newIframe = editor.document.createElement("iframe"), div; if(!url){ alert(lang.enterAddress); return false; } newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url); // /^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : ""; newIframe.setAttribute("width",width); // /^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : ""; newIframe.setAttribute("height",height) scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no"); frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0); //float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align",""); if(iframe){ iframe.parentNode.insertBefore(newIframe,iframe); domUtils.remove(iframe); }else{ div = editor.document.createElement("div"); div.appendChild(newIframe); editor.execCommand("inserthtml",div.innerHTML); } editor._iframe = null; dialog.close(); } dialog.onok = queding; $G("url").onkeydown = function(evt){ evt = evt || event; if(evt.keyCode == 13){ queding(); } }; $focus($G( "url" )); </script> </body> </html>
#964
<?php namespace Addons\WeiSite\Controller; use Addons\WeiSite\Controller\BaseController; class CmsController extends BaseController { var $model; function _initialize() { $this->model = $this->getModel ( 'custom_reply_news' ); parent::_initialize (); } // 通用插件的列表模型 public function lists() { // 使用提示 $normal_tips = '文章的数据来源官方自定义回复插件中的图文回复,如有异常请确认自定义回复插件是否已经安装'; $this->assign ( 'normal_tips', $normal_tips ); $map ['token'] = get_token (); session ( 'common_condition', $map ); $list_data = $this->_get_model_list ( $this->model ); // 分类数据 $map ['is_show'] = 1; $list = M ( 'weisite_category' )->where ( $map )->field ( 'id,title' )->select (); $cate [0] = ''; foreach ( $list as $vo ) { $cate [$vo ['id']] = $vo ['title']; } foreach ( $list_data ['list_data'] as &$vo ) { $vo ['cate_id'] = intval ( $vo ['cate_id'] ); $vo ['cate_id'] = $cate [$vo ['cate_id']]; } $this->assign ( $list_data ); // dump ( $list_data ); $templateFile = $this->model ['template_list'] ? $this->model ['template_list'] : ''; $this->display ( $templateFile ); } // 通用插件的编辑模型 public function edit() { $model = $this->model; $id = I ( 'id' ); if (IS_POST) { //dump($_POST);exit; $_POST['content']=str_ireplace('<iframe src="','#iframesrc#',$_POST['content']); $_POST['content']=str_ireplace('" width="100%" height="300" scrolling="no" frameborder="0"></iframe>','#/iframesrc#',$_POST['content']); $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $Model->save ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '保存' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } // 获取数据 $data = M ( get_table_name ( $model ['id'] ) )->find ( $id ); $data || $this->error ( '数据不存在!' ); $token = get_token (); if (isset ( $data ['token'] ) && $token != $data ['token'] && defined ( 'ADDON_PUBLIC_PATH' )) { $this->error ( '非法访问!' ); } $this->assign ( 'fields', $fields ); $data['content']=str_ireplace('#iframesrc#','<iframe src="',$data['content']); $data['content']=str_ireplace('#/iframesrc#','" width="100%" height="300" scrolling="no" frameborder="0"></iframe>',$data['content']); $this->assign ( 'data', $data ); //dump($data);exit; $this->meta_title = '编辑' . $model ['title']; $this->display (); } } // 通用插件的增加模型 public function add() { $model = $this->model; $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); if (IS_POST) { // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $id = $Model->add ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '添加' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } $this->assign ( 'fields', $fields ); $this->meta_title = '新增' . $model ['title']; $this->display (); } } // 通用插件的删除模型 public function del() { parent::common_del ( $this->model ); } // 获取所属分类 function getCateData() { //$map ['is_show'] = 1; $map ['token'] = get_token (); $list = M ( 'weisite_category' )->where ( $map )->select (); foreach ( $list as $v ) { $extra .= $v ['id'] . ':' . $v ['title'] . "\r\n"; } return $extra; } }
#965
#966
#967
#968
<?php namespace Addons\Bespoke\Controller; use Home\Controller\AddonsController; class BespokeController extends AddonsController{ var $model; function _initialize() { $this->model = $this->getModel ( 'bespoke' ); parent::_initialize (); $act = strtolower ( _ACTION ); $type = I ( 'type' ); $fk=I('get.fk'); $sh=I('get.sh'); $fxsxm=I('get.fxsxm'); $res ['title'] = '预约列表'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists' ); $res ['class'] = ($act == 'lists' || $type == 'text') && !$fk ? 'current' : ''; $nav [] = $res; $res ['title'] = '已付款'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1' ); $res ['class'] = ($fk == '1' || $type == 'text') && !$fxsxm && $sh!='0' ? 'current' : ''; $nav [] = $res; $flist=M('fxs')->select(); foreach($flist as $k=>$v){ $res ['title'] = $v['xm']; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1/fxsxm/'.$v['xm'] ); $res ['class'] = ($fxsxm != '' || $type == 'text') && $fxsxm==$v['xm'] ? 'current' : ''; $nav [] = $res; } //$nd=date('Y-m-d',time()); $res ['title'] = '未审核'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1/sh/0' ); $res ['class'] = ($sh == '0' || $type == 'text') && !$fxsxm ? 'current' : ''; $nav [] = $res; //dump($flist); /*$res ['title'] = '批量导入会员注册'; $res ['url'] = addons_url ( 'Huiyuan://Huiyuan/daoru' ); $res ['class'] = $act == 'daoru' || $type == 'textarea' ? 'current' : ''; $nav [] = $res;*/ $this->assign ( 'nav', $nav ); } }
#969
// $accountPrice = $_GET['num']; // $accountPrice = 111; // $accountPrice = 1112.; // $accountPrice = 2324.1; // $accountPrice = 2324.15; // $accountPrice = 2324.157;//wrong // $accountPrice = 0.57; if (preg_match('/^[0-9]+(.[0-9]{1,2})?$/', $accountPrice)) { echo '整数或小数二位的正则'; }else{ echo '错'; }
确定要清除编辑框内容吗?
该删除操作将不可恢复。
删除 取消
激活Windows
转到"设置"以激活Windows。
#951
#952
1. 获取元素方法 1.根据 id var element = document.getElementById("idName"); 2.根据 标签名 var elements = document.getElementsByTagName("标签名"); 3.根据 类名 var elements = document.getElementsByClassName("类名"); 4.H5新增 获取方法 document.queryselector(""); document.queryselectorAll(""); 5.获取 body 元素 document.body 2. 事件 1.点击事件(双击事件ondblclick) ele.onclick = function(){}; 2.鼠标事件 1.鼠标悬浮(经过) ele.onmouseover = function(){}; 2.鼠标离开 ele.onmouseout = function(){}; onmouseenter和onmouseleave是DOM2的方法, 有兼容问题 onmouseover 鼠标经过盒子的时候执行1次 onmousemove 鼠标只要移动的时候就会执行 3.鼠标按下 ele.onmousedown = function(){}; 4.鼠标弹起 ele.onmouseup = function(){}; 5.鼠标滚动 ele.onmousewheel = function(){}; 3.焦点事件 1.失去焦点 ele.onblur = function(){}; 2.获得焦点 ele.onfocus = function(){}; 3.输入事件 ele.oninput = function(){}; onkeyup和oninput 联想搜索 4.内容发生改变 ele.onchange = function(){}; 一般做验证或者下拉框选择会使用onchange 4.键盘事件 1.键盘键入 ele.onkeydown = function(){}; 2.键盘弹起 ele.onkeyup = function(){}; 3.键盘按下 ele.onleypress = function(){}; onkeydown优先于onkeypress执行 onkeypress不识别系统按键 onkeypress区分大小写 5.window 事件 1.键盘事件 event.keyCode 键盘对应的编码 2.页面滚动 window.onscroll = function(){}; window.scroll必须有滚动条才触发, 一般配合$(window).scrollTop() window.onmousewheel / document.onmousewheel无论有没有滚动条都能触发 3.窗口大小变化 window.onresize = function(){}; 3. 字符串 相关方法 1.replace() 字符串替换 xxx = xxx.replace(searchValue, replaceValue); 只找第一个匹配的替换 2.indexOf() --- lastIndexOf() 搜索(找到 对应的 返回位置) 一个参数从第一个找 两个参数从指定的位置找 不存在返回 -1, 查找的是""返回 0 3.trim() 删除左右空格 4.split("") 字符串 转换成 数组 引号里确定用什么分割 5.charAt() 获取指定位置处字符 6.slice() 从start位置开始,截取到end位置,end取不到 7.substring() 从start位置开始,截取到end位置,end取不到 8.substr() 从start位置开始,截取length个字符 9.toUpperCase() str转换为大写 10.toLowerCase() str转换为小写 4.数组 相关方法 1.join("") 数组 转换成 字符串 引号里确定用什么拼接(默认逗号) 2.toString() 数组 转换为 字符串 (去掉[]) 3.valueOf() 返回数组对象本身 4.Array.isArray(xxx) 检测xxx是否是数组 5.xxx instanceOf Array 检测xxx是否是数组 6.push() pop() 从后边增删 7.unshift() shift() 从前边增删 8.reverse() 翻转数组 9.slice() 从数组中截取一部分内容 10.splice() 从数组中删除或替换数组中的一部分 11. xxx.indexOf() 寻找指定元素在数组中的位置,如果没找到返回-1 12. xxx.lastIndexOf() 从后面找 13.xxx.filter(function(){ }) 迭代过滤/筛选 14.xxx.forEach(function(){ }) 遍历 15.xxx.map(function(){ }) 映射 16.xxx.some(function(){ }) 数组中至少有一个数据符合要求 17.xxx.every(function(){ }) 数组中所有数据符合要求 18.concat() 把一个数组和另一个数组拼接在一起 19.sort() 进行冒泡排序 b-a倒序 a-b升序
#953
解决方法,给svg高度和字体大小一致
<style> embed{font-size: 25px;height: 25px;} </style>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> table{ height: 50px; background: #000; color: white; font-size: 25px; } </style><style> embed{font-size: 25px;height: 25px;line-height:25px;} </style> <body> <table width="100%"> <tr> <th> <embed src="http://23.105.205.22/search.svg" type="image/svg+xml" /> </th> </tr> </table> </body> </html>
#954
<html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:0px; height:0px; border-left:10px solid transparent; border-top:10px solid transparent; border-bottom:10px solid transparent; border-right:10px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
其实原理很简单,首先,border边框是以矩形无缝拼接的,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:10px; height:10px; border-left:50px solid #432a23; border-top:50px solid #38a578; border-bottom:50px solid #38c7c7; border-right:50px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
这样,当div的面积越来越小到为零的时候,梯形的上底也接近于零,也就变成了三角形了,这个时候,再用border的transparent属性将不想要的边框设为透明,即可获得你想要的方向的三角形啦!
#955
<!DOCTYPE html> <html onselectstart="return false"> <head lang="en" > <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } li{ list-style: none; } #main{ width: 300px; height: 300px; left: 50%; top: 50%; position: absolute; background: antiquewhite; } #main-top{ width: 300px; height: 50px; background: #c7cecd; cursor: move; } </style> </head> <body> <div id="main"> <div id="main-top">拖拽我</div> <div id="main-bottom"></div> </div> <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script> <script> $(function(){ var main=$("#main"); var box=$('#main-top'); var offx=0; var offy=0; var mainw=main.width(); var mainh=main.height(); //鼠标按下 box.mousedown(function(ev){ var ev=ev||window.event; //算出点击内容 里面的位置 offx=ev.pageX-main.offset().left; offy=ev.pageY-main.offset().top; //按下过程中 $(document).bind("mousemove",function(ev){ var ev=ev||window.event; //isdraging=true; //当前鼠标的位置 var mousex= ev.pageX; var mousey= ev.pageY; // 动态算出盒子距离屏幕边缘的距离 var xinx=mousex-offx; var xiny=mousey-offy; //可视区宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; //算出盒子边缘距离屏幕的距离 var maxx=pagewidth-mainw; var maxy=pageheight-mainh; //xinx>0 并且 xinx<(页面最大宽度 - 浮层的宽度) //xiny>0 并且 xiny<(页面最大宽度 -浮层的高度) xinx=Math.min(maxx,Math.max(0,xinx)); xiny=Math.min(maxy,Math.max(0,xiny)); // 盒子的偏移量 main.css({left:xinx+"px"}) main.css({top:xiny+"px"}) }) }) //抬起 $(document).mouseup(function(){ $(this).unbind('mousemove'); }) }) </script> </body> </html>
#956
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{margin:0;padding:0} #main{ position: absolute; width: 260px; height: 260px; background: antiquewhite; top: 0; left: 0; } #con{ width: 100%; height: 30px; background: aquamarine; cursor: move; } </style> </head> <body> <div id='main'> <div id='con'>拖动我</div> </div> <script> function $(id){return document.getElementById(id);} // 居中浮层 function aurocenter(el){ // 可视区宽高 var bodyw=document.documentElement.clientWidth; var bodyh=document.documentElement.clientHeight; var elw=el.offsetWidth; var elh=el.offsetHeight; el.style.left=(bodyw-elw)/2+'px'; el.style.top=(bodyh-elh)/2+'px'; } aurocenter($('main')) var offx=0; var offy=0; var tuodong=false; //判断是否可拖动 // 鼠标按下 $('con').addEventListener('mousedown',function(ev){ var ev=ev||window.event; // 算出点击内容 里面的位置 offx= ev.pageX-$('main').offsetLeft; offy= ev.pageY-$('main').offsetTop; tuodong=true; }) // 鼠标移动 document.onmousemove=function(ev){ var ev=ev||window.event; // 鼠标当前位置 var mousex=ev.pageX; var mousey=ev.pageY; var movex=0; var movey=0; if (tuodong===true){ // 计算出盒子距离屏幕边缘的距离 movex=mousex-offx; movey=mousey-offy; // 获取可视区的宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; // 获取大盒子的宽高 var dalogW=$('main').offsetWidth; var dalogH=$('main').offsetHeight; // 算出盒子边缘距离 屏幕边缘的距离 var maxx=pagewidth-dalogW; var maxy=pageheight-dalogH; // movex>0 并且 movex<(页面最大宽度 - 浮层的宽度) movex=Math.min(maxx, Math.max(0,movex)) movey=Math.min(maxy, Math.max(0,movey)) // 盒子偏移量 $('main').style.left=movex+'px'; $('main').style.top=movey+'px'; } } // 鼠标松开 document.onmouseup=function(){ tuodong=false; } window.onresize=function(){ aurocenter($('main')); } </script> </body> </html>
#957
$("body").animate({"scrollTop":top})
修改为,将html和body这两者都加上就可以了
$("html,body").animate({"scrollTop":top})
#958
JS判断用户是否正在浏览当前网页标签
<script> //网页当前状态判断 var hidden, state, visibilityChange,otitle; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; state = "visibilityState"; } else if (typeof document.mozHidden !== "undefined") { hidden = "mozHidden"; visibilityChange = "mozvisibilitychange"; state = "mozVisibilityState"; } else if (typeof document.msHidden !== "undefined") { hidden = "msHidden"; visibilityChange = "msvisibilitychange"; state = "msVisibilityState"; } else if (typeof document.webkitHidden !== "undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; state = "webkitVisibilityState"; } otitle=document.title; // 添加监听器,在title里显示状态变化 document.addEventListener(visibilityChange, function() { //document.title = document[state]; //console.log(document.visibilityState); if(document.visibilityState=='hidden') document.title = '(;°○° ) (x___x) 被离开';//(昏倒) // 被离开 // '+otitle; else document.title = otitle; }, false); //初始化页面状态 //document.title = document[state]; /*var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null; var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange'); var onVisibilityChange = function(){ if (!document[hiddenProperty]) { // console.log('页面非激活'); }else{ document.title ='页面非激活'; //console.log('页面激活') } } document.addEventListener(visibilityChangeEvent, onVisibilityChange);*/ </script>
#959
回源地址填写IP地址 即可,填写域名会出现 403或者超时错误。
<!-- uppu upuu. .upuuuuup. . .uppuppuuuuppppyup uuuyuuypyyupuupyuuuu uupuynnnnnnnpuupuuuu uupppunnnnnnnypupuuu uuuyunnnnnnnnnnyuu. uuuuyyypyynnnuyyupu uuupppp. pynnpppuu. uuuppp. puuupupuu uuuupuyu .pupuuuuu uuuu puuy .puuuuu. uuuuuynnnu .uuuuu y..pppuuyunnuu uuuu. .pu.nu.nyyyuy uuuu yn..yyny...p uuuu u...n.ny.... yuuuu y....nuuupypyyunnn un.unn.yppuunnynunnn un..nynnpuupppu...np. .uu.nyunyuuuuuuup.n.n. yn...nuuuypppupuuunnuu pp..conuuyypyyyypupnny unnucoonuuypuupuuyyuypy n.npuconyyyppyppyyu.... ... ycupupppppuy.cc.nyu uu pyupuupupp.occ.nuy uuuuppypupup u.uuu uuuuuuuuuu yyy ..uyppuuuuu .upncccccccc.y .uuuuuucccccnypuuuuuu.. .uuuuuuup....upuuuuuuuuuuuuuu. .uuuuuuuuu. .uuuppuuuuuuuuuuuu uuuuuuuuu ..upuppp uuuuuuu. uuppy uuuuuuu ppupu upuuupp. puuuu upppyup. pupu .upupyp .puu upupyy pup upuuu uup .upu .pp .uuuu ppu upupu puu. pppp uuuuu. uuuu .uuuuuuu.. .pppp .. .... .pppp. -->
#960
这是炎热小镇慵懒的一天。太阳高挂,街道无人,每个人都债台高筑,靠信用度日。
这时,从外地来了一位有钱的旅客,他进了一家旅馆,拿出一张1000元钞票放在柜台,说 想先看看房间,挑一间合适的过夜。
就在此人上楼的时候,店主抓了这张1000元钞,跑 到隔壁屠户那里支付了他欠的肉钱。
屠夫有了1000元,横过马路付清 了猪农的猪本钱。
猪农拿了1000元,出去付了他欠的饲料款。
那个卖饲料的老兄,拿到1000元赶忙去付清他召妓的钱(经济不景气,当地的服务业也不得不提供信用服务)。
有了1000元 ,这名妓 女冲到旅馆付了她所欠的房钱。
旅馆店主忙把这1000元放到柜台上,以免旅客下楼时起疑。
此时那人正下楼来,拿起1000元, 声称没一间满意的,他把钱收进口袋,走了……这一天,没有人生产了什么东西,也没有人得到什么东西,可全镇的债务都清了,大家很开心。
#961
<script> var str = '<iframe frameborder="0" width="640" height="498" src="https://v.qq.com/iframe/player.html?vid=b0516dp12du&tiny=0&auto=0" allowfullscreen></iframe>'; alert(str.match(/<iframe .*?src=\"(.+?)\"/)[1]);</script>
#962
//获取视频数据的地址 ,getMovieUrl:URL+"php/getMovie.php" //视频数据获取地址 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义 , toolbars: [["fullscreen","source","undo","redo","insertunorderedlist","insertorderedlist","unlink","link","cleardoc","selectall","print","searchreplace","preview","help","insertimage","snapscreen","emotion","horizontal","anchor","spechars","blockquote","insertcode","bold","italic","underline","strikethrough","forecolor","backcolor","superscript","subscript","justifyleft","justifycenter","justifyright","justifyjustify","touppercase","tolowercase","directionalityltr","directionalityrtl","indent","removeformat","formatmatch","autotypeset","customstyle","paragraph","rowspacingbottom","rowspacingtop","lineheight","fontfamily","fontsize","imagenone","imageleft","imageright","imagecenter","inserttable","deletetable","mergeright","mergedown","splittorows","splittocols","splittocells","mergecells","insertcol","insertrow","deletecol","deleterow","insertparagraphbeforetable","insertframe"]] //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
#963
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="../internal.js"></script> <style type="text/css"> .warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;} #url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; } .format span{display: inline-block; width: 58px;text-align: center; zoom:1;} table td{padding:5px 0;} #align{width: 65px;height: 23px;line-height: 22px;} </style> </head> <body> <div class="warp"> <table width="300" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" class="format"> <span style=" width: auto; ">填写复制通用代码</span><!-- <var id="lang_input_address"></var> --> <!-- <input style="width:200px" id="url" type="text" value=""/> --> <textarea style=" width: 100%; height: 119px; " id="url" ></textarea> </td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td> </tr> <tr style="display:none;"> <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td> <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td> </tr> <tr style="display:none;"> <td colspan="2"><span><var id="lang_input_alignMode"></var></span> <select id="align"> <option value=""></option> <option value="left"></option> <option value="right"></option> </select> </td> </tr> </table> </div> <script type="text/javascript"> var iframe = editor._iframe; if(iframe){ $G("url").value = iframe.getAttribute("src")||""; var str = $G("url").value; $G("url").value = (str.match(/<iframe .*?src=\"(.+?)\"/)[1]); $G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||""; $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||""; $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false; $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false; $G("align").value = iframe.align ? iframe.align : ""; } function queding(){ var url = ($G("url").value.match(/<iframe .*?src=\"(.+?)\"/)[1]),//$G("url").value.replace(/^\s*|\s*$/ig,""), width = '100%',//$G("width").value, height = '300',//$G("height").value, scroll = $G("scroll"), frameborder = $G("frameborder"), //float = $G("align").value, newIframe = editor.document.createElement("iframe"), div; if(!url){ alert(lang.enterAddress); return false; } newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url); // /^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : ""; newIframe.setAttribute("width",width); // /^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : ""; newIframe.setAttribute("height",height) scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no"); frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0); //float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align",""); if(iframe){ iframe.parentNode.insertBefore(newIframe,iframe); domUtils.remove(iframe); }else{ div = editor.document.createElement("div"); div.appendChild(newIframe); editor.execCommand("inserthtml",div.innerHTML); } editor._iframe = null; dialog.close(); } dialog.onok = queding; $G("url").onkeydown = function(evt){ evt = evt || event; if(evt.keyCode == 13){ queding(); } }; $focus($G( "url" )); </script> </body> </html>
#964
<?php namespace Addons\WeiSite\Controller; use Addons\WeiSite\Controller\BaseController; class CmsController extends BaseController { var $model; function _initialize() { $this->model = $this->getModel ( 'custom_reply_news' ); parent::_initialize (); } // 通用插件的列表模型 public function lists() { // 使用提示 $normal_tips = '文章的数据来源官方自定义回复插件中的图文回复,如有异常请确认自定义回复插件是否已经安装'; $this->assign ( 'normal_tips', $normal_tips ); $map ['token'] = get_token (); session ( 'common_condition', $map ); $list_data = $this->_get_model_list ( $this->model ); // 分类数据 $map ['is_show'] = 1; $list = M ( 'weisite_category' )->where ( $map )->field ( 'id,title' )->select (); $cate [0] = ''; foreach ( $list as $vo ) { $cate [$vo ['id']] = $vo ['title']; } foreach ( $list_data ['list_data'] as &$vo ) { $vo ['cate_id'] = intval ( $vo ['cate_id'] ); $vo ['cate_id'] = $cate [$vo ['cate_id']]; } $this->assign ( $list_data ); // dump ( $list_data ); $templateFile = $this->model ['template_list'] ? $this->model ['template_list'] : ''; $this->display ( $templateFile ); } // 通用插件的编辑模型 public function edit() { $model = $this->model; $id = I ( 'id' ); if (IS_POST) { //dump($_POST);exit; $_POST['content']=str_ireplace('<iframe src="','#iframesrc#',$_POST['content']); $_POST['content']=str_ireplace('" width="100%" height="300" scrolling="no" frameborder="0"></iframe>','#/iframesrc#',$_POST['content']); $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $Model->save ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '保存' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } // 获取数据 $data = M ( get_table_name ( $model ['id'] ) )->find ( $id ); $data || $this->error ( '数据不存在!' ); $token = get_token (); if (isset ( $data ['token'] ) && $token != $data ['token'] && defined ( 'ADDON_PUBLIC_PATH' )) { $this->error ( '非法访问!' ); } $this->assign ( 'fields', $fields ); $data['content']=str_ireplace('#iframesrc#','<iframe src="',$data['content']); $data['content']=str_ireplace('#/iframesrc#','" width="100%" height="300" scrolling="no" frameborder="0"></iframe>',$data['content']); $this->assign ( 'data', $data ); //dump($data);exit; $this->meta_title = '编辑' . $model ['title']; $this->display (); } } // 通用插件的增加模型 public function add() { $model = $this->model; $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); if (IS_POST) { // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $id = $Model->add ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '添加' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } $this->assign ( 'fields', $fields ); $this->meta_title = '新增' . $model ['title']; $this->display (); } } // 通用插件的删除模型 public function del() { parent::common_del ( $this->model ); } // 获取所属分类 function getCateData() { //$map ['is_show'] = 1; $map ['token'] = get_token (); $list = M ( 'weisite_category' )->where ( $map )->select (); foreach ( $list as $v ) { $extra .= $v ['id'] . ':' . $v ['title'] . "\r\n"; } return $extra; } }
#965
SyntaxError: Missing parentheses in call to 'print'
原因:Mac安装俩个python版本,2和3,python2系列可以支持 print “xxxx” ,python系列需要使用print("xxx")
#966
选择“编辑选项”里的“快速编辑模式”,并确定之;
#967
码农的集体困境
心理学专家武志红在分析苏享茂自杀事件时认为,指责当事人自杀实际是因为不能理解亲人背叛对当事人带来的心理绝望。
我很认同这一点,同时认为苏享茂自杀不仅是他一个人的悲剧,也反映了程序员群体的心理和认知困境。
抛开道德评价,翟欣欣长得很不错。前天我刚看到翟欣欣照片就发给一位程序员大牛求评价,大牛一语道破说这长相码农是挡不住的。其实苏享茂的同班同学发帖也提到,小茂这样一直做技术、圈子极小的简单老实程序员根本挡不住精心设计的圈套。
小说里的程序员个个都是蜘蛛侠,真实的码农很多却只是蜘蛛。回到现实中的程序员很多只会上班埋头码字,下班用硬盘探索人生。
客观上高企的专业壁垒挡住了很多普通人对程序员世界的窥视,但也反过来挡住码农们对外界交流的路径。码农在代码世界里如鱼得水,但不论在设计、运营、管理还是更重要的生活交际中,所依靠的却是对人性的理解。
程序员的世界很单纯,高强度的职业训练让很多程序员潜意识里把代码的逻辑关系投射到现实世界。然而复杂的人性并不是以严谨的逻辑为基础,更多折射基于利益的精打细算和情绪的任性。
码农们大多单纯,他们成天流连于代码之中,渴望凡间的幸福却又不懂凡间的故事。如果你给码农一个美丽的肥皂泡或者画一个大饼,然而幻象迅速破灭甚至如一桶冰凉的水泼在码农身上,外人很难想象一个单纯码农的无助和绝望。当码农发现代码没有办法给他答案又无法承担给朋友添麻烦的心理压力时,悲剧的发生是高概率的。
苏享茂的悲剧虽然基于一个恶意的圈套,但他自己的不谙世事和过分单纯也是导致事情最终恶化的重要原因。在这一点上苏享茂只能代表自己而不是代表大多数程序员,但程序员作为一个群体和真实世界的融入程度的确不如销售、律师、管理等职业基于关系和沟通的群体。
希望苏享茂的悲剧能让全社会更多关注程序员群体的心理健康,更希望程序员能主动走出代码的象牙塔,走进有丑恶但也有真善的真实世界。
各自在里面写邮件存草稿,并不发出去,以此来交流但是可以躲开审查
#968
<?php namespace Addons\Bespoke\Controller; use Home\Controller\AddonsController; class BespokeController extends AddonsController{ var $model; function _initialize() { $this->model = $this->getModel ( 'bespoke' ); parent::_initialize (); $act = strtolower ( _ACTION ); $type = I ( 'type' ); $fk=I('get.fk'); $sh=I('get.sh'); $fxsxm=I('get.fxsxm'); $res ['title'] = '预约列表'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists' ); $res ['class'] = ($act == 'lists' || $type == 'text') && !$fk ? 'current' : ''; $nav [] = $res; $res ['title'] = '已付款'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1' ); $res ['class'] = ($fk == '1' || $type == 'text') && !$fxsxm && $sh!='0' ? 'current' : ''; $nav [] = $res; $flist=M('fxs')->select(); foreach($flist as $k=>$v){ $res ['title'] = $v['xm']; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1/fxsxm/'.$v['xm'] ); $res ['class'] = ($fxsxm != '' || $type == 'text') && $fxsxm==$v['xm'] ? 'current' : ''; $nav [] = $res; } //$nd=date('Y-m-d',time()); $res ['title'] = '未审核'; $res ['url'] = addons_url ( 'Bespoke://Bespoke/lists/model/bespoke/fk/1/sh/0' ); $res ['class'] = ($sh == '0' || $type == 'text') && !$fxsxm ? 'current' : ''; $nav [] = $res; //dump($flist); /*$res ['title'] = '批量导入会员注册'; $res ['url'] = addons_url ( 'Huiyuan://Huiyuan/daoru' ); $res ['class'] = $act == 'daoru' || $type == 'textarea' ? 'current' : ''; $nav [] = $res;*/ $this->assign ( 'nav', $nav ); } }
#969
// $accountPrice = $_GET['num']; // $accountPrice = 111; // $accountPrice = 1112.; // $accountPrice = 2324.1; // $accountPrice = 2324.15; // $accountPrice = 2324.157;//wrong // $accountPrice = 0.57; if (preg_match('/^[0-9]+(.[0-9]{1,2})?$/', $accountPrice)) { echo '整数或小数二位的正则'; }else{ echo '错'; }