Skip to content

Instantly share code, notes, and snippets.

View alanerzhao's full-sized avatar
🎯
Focusing

螃蟹 alanerzhao

🎯
Focusing
View GitHub Profile
//dataAPI : 'http://roll.news.sina.com.cn/interface/rollnews_ch_out_interface.php',
function Person (name,age,job) {
//防止全局作用域意外对象属性
if(this instanceof Person) {
this.name = name;
this.age = age;
this.job = job;
} else {
return new Person(name,age,job);
}
var text3 = document.getElementById("text3");
var text2 = document.getElementById("text2");
text2.focus()
text2.onfocus = function () {
this.select();
}
var tips = document.createElement("span");
text3.onselect = function () {
//console.log(this.selectionStart,this.selectionEnd)
//console.log(this.value.substring(this.selectionStart,this.selectionEnd));
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
</head>
<body id="MF">
<!--header-->
<?php $this->load->view('common/header');?>
<!-- Container Start -->
<div class="container">
@alanerzhao
alanerzhao / loadmore.js
Last active December 28, 2015 04:38
sad
//load more
(function () {
var loadObj = $(".loading-more"),
tabModCont = $(".tab-mod-content ul"),
tmpl ='',
lastBtnPos,
i = 1;
loadObj.click(function () {
i++;
lastBtnPos = loadObj.offset().top + $(document.body).scrollTop();
@alanerzhao
alanerzhao / bom.js
Last active December 28, 2015 02:18
function getElement (id) {
if(document.getElementById) {
return document.getElementById(id);
} else if(document.all) {
return document.all[id];
} else {
throw new Error("No way!")
}
}
function isSortable(object) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#main {
border: 10px solid blue !important;
}
.sty_360 {
function getQueryStringArgs () {
// URL length get "?" before string
var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
args = {},
//切分成数组
items = qs.length ? qs.split("&") : [],
item = null,
name = null,
value = null,
i = 0,
function SuperType (name) {
this.name = name;
this.colors = ['red','blue','green'];
}
SuperType.prototype.sayName = function () {
console.log(this.name);
}
function SubType(name,age) {
SuperType.call(this,name);
@alanerzhao
alanerzhao / build+proto.js
Created November 5, 2013 14:59
组合使用构造函数+原型
function Funname () {
this.param = param;
this.arr = [1,2];
}
Funname.prototype = {
constuctor: Funname,
method : function () {
}
function ajaxCall() {
$("#LoadingImage").show();
$.ajax({
type: "GET",
url: "http://api.flickr.com/services/feeds/photos_public.gne?tags=car&tagmode=any&format=json&jsoncallback=?",
dataType: "jsonp",
success: function(data) {
console.log(data);
$("#LoadingImage").hide();
},