`
mutongwu
  • 浏览: 454064 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论
文章列表
function encodeUTF8(str){ var temp = "",rs = ""; for( var i=0 , len = str.length; i < len; i++ ){ temp = str.charCodeAt(i).toString(16); rs += "\\u"+ new Array(5-temp.length).join("0") + temp; } return rs; } function decodeUTF8(str){ ...
<div class="pageBar"> <form class="pageForm" action=""> <a class="link" href="" title="上一页"><</a> <span class="link curr">1</span> <a class="link" hr ...
备忘: 系统环境win7 1.下载 nodejs 32bit的,得到一个node.exe文件 2. 设置环境变量; 3.下载 npm文件,得到一个zip文件,解压到nodejs的目录下,这个时候,nodejs目录下有: 文件node.exe 、文件夹 node_modules、文件npm.cmd 共三个文件(夹) 4.安装 python2.7,设置环境变量; 5. 安装 visual c++ 2010; 6. 执行 npm install jsdom 7.搞定! 安装的问题:之前 执行第6步的时候,总是提示: “C:\Users\shawn\.node-gyp\0.10. ...

网站图片抓取

代码没有优化,仅仅作为大概的流程记录: var http = require('http') , fs = require('fs'); var urlTpl = 'http://somedomain/loadmore.ashx?page={PAGE}&price=0&brandid=0&country=0&deliveryCapacity=0&level=0&struct=0&seat=0'; var counter = 0; var page = 1, saveImage = function(res,na ...
function setCaret(el,start,end){ el.focus(); if(start === true){ start = el.value.length; } if(typeof end === 'undefined'){ end = start; }else if(end === true){ end = el.value.length; } start = Math.max(0,start); end = Math.min(end,el.value.length); if (" ...
//可以完全检测用户通过键盘、粘贴、页面拖拽文字的输入: var i = document.getElementById('inputBox'); if('onpropertychange' in i){ //IE i.onpropertychange = function(){ if(window.event.propertyName == 'value'){ target.value += 'onpropertychange:'; } } }else if('oninput' in i){ //Other ...
备忘一下 备忘一下: 一. Apacha2.2 修改 httpd.conf, 添加以下配置: #PHP配置 LoadModule php5_module "D:/PHP5.4/php5apache2_2.dll" AddHandler application/x-httpd-php .php # 配置 php.ini 的路径 PHPIniDir "D:/PHP5.4" #修改一下配置,让apache优先转发php请求 <IfModule dir_module& ...
转自MDN: <!doctype html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <title>Image preview example</title> <script type="text/javascript"> var loadImageFile = (function () { if (w ...
function scrollFunc(e){ if(e.wheelDelta){ //W3C 向上120/向下-120,opera 在V9.5之前的取值是反的。 return isOpera && ver < 9.5 : -e.wheelDelta:e.wheelDelta; }else if(e.detail){ // firefox : 向上-3/向下3 return e.detail * -40; } } if(document.addEventListener) ...
iframe跨域的 高度自适应。 这里需要利用一个代理页面,稍微显得有点麻烦。不过目前也没发现更好的方法。 页面嵌套示意: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; cha ...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type="text/javascript"> </script> <style type="text/css"> *{margin:0;padding:0;} body{width:100% ...

右下角弹窗

function show(){ var div = document.createElement("div"); div.id = "xxx"; div.innerHTML = "<h3>wowo</h3>" div.style.cssText = "position:fixed;bottom:-1000px;right:0;width:100px;height:100px;border:1px solid #000; ...
IE6/7由于使用引用计数,容易产生内存泄露问题。 事件注册,由于容易使用闭包,导致问题产生: //循环引用:element的事件函数(闭包)可以指向element。 var addListener = function (element, eventName, handler) { element.attachEvent('on' + eventName, function () { handler.call(element, window.event); }); }; 一种处理的方式,就是先把事件函数存起来,在页面离开的时候,进行事件的移除,解除循 ...
....... <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ........ <form id="fabokeForm" method="GET" action="json.asp" accept-charset="GBK" target="hiddenIframe"> ..... ...... </form> ...
bf-cache: 通过浏览器的导航:向前、向后,Firefox默认会进行缓存页面,不会重新触发 onload事件,页面看起来就跟离开的时候一样。一种规避方式是,添加 Unload事件: 实例: http://www.jakearchibald.co.uk/jsperformance/backforwardcache/ 资料: https://developer.mozilla.org/zh-CN/docs/Using_Firefox_1.5_caching https://developer.mozilla.org/zh-CN/docs/Working_with_BFCache
Global site tag (gtag.js) - Google Analytics