这段代码可以在客户端检测常用的操作系统类型//OS DETECTION...var OSName="Unknown OS";if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";if (navigator.appVer……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1809浏览 223个赞
本js代码通过对js对象进行各方面的比较来判断两个对象是否相等Object.equals = function( x, y ) { // If both x and y are null or undefined and exactly the same if ( x === y ) { retu……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2813浏览 1485个赞
JS通过navigator对象检测浏览器的类型,这个函数可以直接用在你的项目中,非常方便function whichBrs() { var agt=navigator.userAgent.toLowerCase(); if (agt.indexOf("opera") != -1) return 'Opera'……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2601浏览 575个赞
jQuery实现的多选<!DOCTYPE /><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <t……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2018浏览 2030个赞
非常完善的Email正则表达式验证function _validateEmail( $email ){ var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2690浏览 1714个赞
简单的JavaScript显示和隐藏元素// show or hide a selected element// if no state is given, the visibility is toggled// otherwise visibility is set to hidden or visible as selectedfunctio……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2068浏览 392个赞
非常不错的js二进制时钟代码/******************************************************************************** Snarkles.Net Useless Binary Time (SNUBT)* * ThinkGeek's Binary LED Clock.……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1473浏览 2771个赞
Javascript通过clientWidth,scrollWidth获取窗口宽度和高度<SCRIPT LANGUAGE="JavaScript"> var s = "网页可见区域宽 :"+ document.body.clientWidth; s += "\r\n网页可见区域高……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2152浏览 1877个赞
用户选择表格数据时,点击某行,高亮显示某行<html><head><title></title><style type="text/css"> .trbg { background-color:Red; }</style> <s……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2625浏览 2684个赞
定义了一个可以反复指定指定函数的类,功能类似于javascript中setTimeout# Simple version:import sys, timeclass RetryError(Exception): passdef retryloop(attempts, timeout): starttime = time.time(……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2759浏览 1384个赞
JavaScript直接跳出下载的简单方法window.location = "../File/sharejs.zip";……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1290浏览 739个赞
php查询数据库显示小图,点击小图弹出大图<?php //Get all the images in the database (use a WHERE clause to limit what it finds) $sql = mysql_query("SELECT * FROM database_name"); //……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1187浏览 722个赞
这段代码演示了如何通过php建立一个简单的用户注册表单及提交程序<?php if(isset($_POST['submit'])){ # connect to the database here # search the database to see if the user name has been ……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2490浏览 433个赞
js实现的单位轮流值班轮换表<script language="javascript"> var src="张三,李四,王五,赵六,钱七,孙八,曾久" var srcArray=src.split(",") var beginDate=new Date(20……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2238浏览 2736个赞
javascript通过正则表达式验证用户输入的金额是否正确<script type="text/javascript"> <!-- function MoneyCheck(){ var isNum = /^\d+(\.\d+)?$/; var money = docum……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1830浏览 224个赞
通过记录开始时间和结束时间计算一段脚本的之行时间<?php //Create a variable for start time $time_start = microtime(true); // Place your PHP/HTML/JavaScript/CSS/Etc. Here //Create a variable for en……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2278浏览 1677个赞
JS如何访问navigator.* 变量<script type="text/javaScript"><!-- // dw() is just a alias for document.write()// to make the code shorter function dw(s){ docu……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2794浏览 2491个赞
JavaScript通过正则表达式处理url参数var url='www.baidu.com?a=123&b=456&c=789&e=dfsdfsdfsdfsdfsdfsdf&f=46545454545454785&g=e23232dsfvdfvdf'; /** * 格式化查询字符串(正则……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2169浏览 1302个赞
通过JS打开图片另存为对话框,提示用户保存文件<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> New Document </title> <……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2697浏览 413个赞
JavaScript判断浏览器的类型var request = false;var btype=getinternet(); function getinternet() { if(navigator.useragent.indexof("msie")>0) { ret……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2195浏览 1682个赞
node.js log模块日期格式化 在node.js开发过程中使用了npm install log默认下载的模块,日期时间很不符合习惯。[Tue Dec 25 2012 21……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2666浏览 912个赞
本代码首先通过head进行301转向,如果失败,则通过http-equiv=”Refresh”转向,如果不行再通过js进行转向,再不行直接在页面上输出链接地址让用户自己点击链接转向function safe_redirect($url, $exit=true) { // Only use the header red……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2966浏览 2380个赞
javascript获取当前鼠标的坐标位置<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ht……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2148浏览 1336个赞
一个伦敦奥运会倒计时的JS代码,简单的修改一下就可以用作其它倒计时<SCRIPT LANGUAGE="JavaScript"> //作者:www.tongqiong.com<!-- var urodz= new Date("July 28,2012"); var s="伦敦奥……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1818浏览 327个赞
JS解析json数据并将json字符串转化为数组的实现方法,json数据在ajax实现异步交互时起到了很重要的作用,他可以返回请求的数据,然后利用客户端的js进行解析,这一点体现出js的强大,本文介绍JS解析json数据并将json字符串转化为数组的实现方法。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML……继续阅读 » 水墨上仙 4年前 (2021-03-12) 3066浏览 2290个赞
html5 canvas制作的简单时钟效果<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <style type="text/css&……继续阅读 » 水墨上仙 4年前 (2021-03-12) 1816浏览 2192个赞
JS redirect转向方法<script type="text/javascript"><!-- window.location = "http://www.google.com/"//--></script>……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2497浏览 2478个赞
jquery限制textarea的字数长度并显示已输入字符长度<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">……继续阅读 » 水墨上仙 4年前 (2021-03-12) 2879浏览 2244个赞
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'a' available at org.springframework.beans.factory……继续阅读 » 开心洋葱 4年前 (2021-03-12) 2051浏览 0评论1725个赞
修改一下第二行的url地址即可获得你想要的网页的html代码<?php // display source code $lines = file('http://google.com/'); foreach ($lines as $line_num => $line) { // loop thru e……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2450浏览 0评论949个赞
php版快速排序代码function quicksort($seq){ if(!count($seq)) return $seq; $k = $seq[0]; $x = $y = array(); for($i=count($seq); --$i;) { if($seq[$i] <= $k) { $x[] = $……继续阅读 » 水墨上仙 4年前 (2021-03-10) 3066浏览 0评论1598个赞
jQuery读写操作cookie的代码演示,可以对cookie进行读写操作,可以设置域名和过期时间 插件代码/*! * jQuery Cookie Plugin v1.3 * https://github.com/carhartl/jquery-cookie * * Cop……继续阅读 » 水墨上仙 4年前 (2021-03-10) 3097浏览 0评论296个赞
这段代码可以帮助你判断任意图片的主色调,使用了简单的统计算法实现$i = imagecreatefromjpeg("image.jpg"); for ($x=0;$x<imagesx($i);$x++) { for ($y=0;$y<imagesy($i);$y++) { $rg……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1926浏览 0评论405个赞
需要判断代码运行环境是否是HTTPS服务器,只需要判断_SERVER[‘HTTPS’]是否打开即可if ($_SERVER['HTTPS'] != "on") { echo "This is not HTTPS"; }else{ echo &……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2868浏览 0评论2585个赞
php实现二分查找算法// $low and $high have to be integersfunction BinarySearch( $array, $key, $low, $high ){ if( $low > $high ) // termination case { return -1; ……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1756浏览 0评论142个赞
php检查日期是否合法function check_date($date) { //检查日期是否合法日期 $dateArr = explode("-", $date); if (is_numeric($dateArr[0]) && is_numeric($dateArr[1]) &&……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1747浏览 0评论2494个赞
php自己实现memcached的队列类<?php/* * memcache队列类 * 支持多进程并发写入、读取 * 边写边读,AB面轮值替换 * @author lkk/lianq.net * @create on 9:25 2012-9-28 * * * @example: * $obj = new memcacheQu……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1790浏览 0评论1188个赞
php无限分类获得当前位置的函数<?php/* * @name pcb_article_position * @access public * @param int $id * @param string $split * @return string */function pcb_article_position ……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2725浏览 0评论2608个赞
php获取访问者浏览器<? function browse_infor() { $browser="";$browserver=""; $Browsers =array("Lynx","MOSAIC","AOL","Opera&q……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1405浏览 0评论2762个赞
php检查时间是否合法function check_time($time) { //检查时间是否合法时间 $timeArr = explode(":", $time); if (is_numeric($timeArr[0]) && is_numeric($timeArr[1]) &&am……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1394浏览 0评论1206个赞
php时间比较函数,返回两个日期相差几秒、几分钟、几小时或几天 function DateDiff($date1, $date2, $unit = "") { //时间比较函数,返回两个日期相差几秒、几分钟、几小时或几天 switch ($unit) { case 's': ……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2965浏览 0评论2540个赞
php把全角数字转换为半角数字<? function GetAlabNum($fnum){ $nums = array("0","1","2","3","4","5","6","……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2263浏览 0评论2841个赞
php重定向的三种方法<? 方法一:header("Location: index.php"); 方法二:echo "<scrīpt>window.location ="$PHP_SELF";</scrīpt>"; //OSPHP.COm.CN 方法三:ec……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2771浏览 0评论1274个赞
php写入文件函数<? function writetofile($file_name,$data,$method="w") { $filenum=fopen($file_name,$method); //OSPHP.COM.Cn开源 flock($filenum,LOCK_EX); $file_data=fwrite……继续阅读 » 水墨上仙 4年前 (2021-03-10) 2328浏览 0评论2450个赞
php相对路径转换成绝对路径<? function relative_to_absolute($content, $feed_url) { preg_match('/(http|https|ftp):///', $feed_url, $protocol); $server_url = preg_rep……继续阅读 » 水墨上仙 4年前 (2021-03-10) 1905浏览 0评论1093个赞