ITeye博客

海天片语的博客

海天片语 · 共 114 篇文章

jquery 有用代码片段

1、检测Internet Explorer版本 当涉及到CSS设计时,对开发者和设计者而言Internet Explorer一直是个问题。尽管IE6的黑暗时代已经过去,IE也越来越不流行,它始终是一个能够容易检测的好东西。当然了,下面的代码也能用于检测别的浏览器。 $(document).ready(function() { if (navigator.userAgent.match(/msie/i) ){ alert('I am an old fashioned Internet Explorer'); } }); 2、平稳滑动到页面顶部 这是一个最广泛使用的jQuery效果:对一个链接点…

2016-04-23 19:29 · js · 评论(0)

滚动条 伪元素

::-webkit-scrollbar { width: 0 !important } .id { margin: 0 auto; overflow: auto; } /quote]

2016-04-13 16:37 · html · 评论(0)

centos 6 更新 libcurl

1) 创建一个新文件 /etc/yum.repos.d/city-fan.repo 2) 复制下面的到上面文件中: [cityfan] name=City Fan Repo baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel5/x86_64/ enabled=1 gpgcheck=0 3) 操作: yum clean all yum install curl 4) service nginx restart service php-fpm restart And it's done. Observe that for other…

2015-12-23 11:28 · centos · 评论(0)

formvalidation

<script> seajs.config({ base: 'http://wanghj', alias: { '$': 'jquery/1.11.2/jquery-1.11.2.min.js', 'jquery': 'jquery/1.11.2/jquery-1.11.2.min.js', 'bootstrap': 'bootstrap/3.3.4/js/bootstrap.min.js', 'formvalidation': 'formvalidation/0.6.0/formValidation.js', 'formvalidation-bootstrap':'formvalidati…

2015-11-03 11:36 · html · 评论(0)

html5 实现输入框实时搜索

function searchText(){ var content =""; var inputVal=$('#siteInput').val(); var siteNum = {'张三':"桌1", '李四':"桌2"}; var found = false; for( var key in siteNum){ if(key == inputVal) { content = siteNum[key]; found = true; } } if(!found && inputVal != "") { content = '未找到'; } $('#siteSearch>p').text(co…

2015-10-09 15:48 · html5 · 评论(0)

HTML5 禁止表单提交

$("form").submit(function(){ event.preventDefault(); });

2015-10-09 15:47 · html5 · 评论(0)

远程连接不上mysql 报错:1130-host ... is not allowed to connect to this MySql server

[b [size=xx-small]授权法:[/size][/b] 例如,你想user使用password从任何主机连接到mysql服务器的话。 GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES; 如果你想允许用户user从ip为192.168.1.8的主机连接到mysql服务器,并使用password作为密码 GRANT ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.8' IDENTIFIED B…

2015-09-02 09:23 · mysql · 评论(0)

windows 下 安装 apache2.4.16

第一部分:安装Apache2.4.16 1.下载回来的是解压文件,解压好放到要安装的位置。(以D:\Acpache24为例) 2.打开Apache24\conf下httpd.conf 文件,用记事本打开即可。 (1)把ServerRoot "c:/Apache24"改为“D:/Apache24”。 (2) 有些安装迅雷的要把Listen 80 改为 Listen 8080 3.启动Apache。 开始 --- 运行,输入cmd,打开命令提示符。接着输入d:回车cd Apache24\bin回车 httpd.exe -k install 回车 提示如下成功: [img] [img]http:/…

2015-08-28 14:13 · apache · 评论(0)

下拉框 取值汇总

<select id="HostAccount" name="" onchange="HostClient("ORACLE")" style="margin-right: 12px; width: 145px; color: rgb(0, 0, 0);"> <option value="null" style="color:#999" acctype="0">用户填写</option> <option value="532" style="color:#000" acctype="1" selected="selected">system</option> <option value="55…

2015-08-21 14:40 · html · 评论(0)

js 判断本地文件

var fso, s=filespec; // filespec="C:/path/myfile.txt" fso=new ActiveXObject("Scripting.FileSystemObject"); if(fso.FileExists(filespec)) s+=" 文件存在."; else s+=" 文件不存在."; alert(s);

2015-08-18 11:31 · js · 评论(0)

使用pack 填充空白符 unpack解

<?php $book = array(array('Elmer Gantry', 'Sinclair Lewis', 1927), array('The Scarlatti Inheritance', 'Robert Ludlum', '1971'), array('The Parsifal Mosaic', 'William Styron', '1979')); $i = 0; foreach($book as $bookline){ $var[$i] = pack('A25A14A4', $bookline[0], $bookline[1], $bookline[2]); $i++; …

2015-08-10 15:43 · php · 评论(0)

php lookandsay

<?php function lookandsay($str){ $r = ''; $m = $str[0]; $n = 1; for($i=1; $i<strlen($str); $i++){ if($str[$i] == $m){//如果这个字符与上个字符相同则数目加1 $n++; }else{ $r .= $n.$m;//反之,把数目和这个字符追加到返回值 $m = $str[$i];//赋值下一个字符 $n = 1; } } return $r.$n.$m; } for($i = 0,$str = 1; $i < 9; $i++){ $str = lookandsay($str); …

2015-08-07 18:01 · php · 评论(0)

php strpos 为什么没找到要用 ===false 做判断

如果这个字符串中没有找到相应的子字符串 就返回false 如果这个子字符串位于字符串的开始处 就会返回0 为了区分 0 和 false 就必须使用等同操作符 === 或者 !==

2015-08-07 14:36 · php · 评论(0)

php 遍历一个文件夹下面的子文件

function my_scandir($dir) { $files=array(); if(is_dir($dir)) { if($handle=opendir($dir)) { while(($file=readdir($handle))!==false) { if($file!=”.” && $file!=”..”) { if(is_dir($dir.”/”.$file)) { $files[$file]=my_scandir($dir.”/”.$file); } else { $files[]=$dir.”/”.$file; } } } closedir($handle); retu…

2015-08-05 15:57 · php · 评论(0)

判断 页面技巧

js: if (document.getElementById("test1-header")){ $("#test1-header").click(); } jquery: if($('#container').length){ $('#log').append('#container存在页面中'); //使用$('#container').length来判断id="container"的元素是否存在,存在则> } 判断页面元素是否可见 相关代码: if($('#container').is(':visible')){ //如果需要判断是否隐藏,请使用is(':hidden') $('#l…

2015-07-31 11:58 · html · 评论(0)