Git Product home page Git Product logo

jsbox's Introduction

JavascriptBox

持续更新一些通用性的Javascript代码模块

###js常用方法 client函数:检测client的system版本、browser版本、浏览器引擎
添加String的trim方法和len(求字符串长度,双字节字符串长度记为2)

###js正则表达式
正则表达式字面量表示/pattern/flag和对象表示new RegExp("pattern","flag")
flag标志三种方式:g表示全局,i表示不区分大小,m表示多行模式
正则表示式三个方法:exec(),test(),compile()
字符串支持模式匹配的方法:match(),search(),replace(),split()

###js事件 EventUtil对象为处理不同浏览器的事件兼容提供一些函数
form表单的提交事件和重置事件

var form = document.getElementById("myForm");
EventUtil.addHandler(form,"submit",function(event){
    event = EventUtil.getEvent(event);
    //此处对表单进行校验
    EventUtil.preventDefault(event);
});
//form表单进行提交
form.submit();

###js知识点小结

  • for in循环的变量,必须先判断变量不为null和undefined,因为有些浏览器执行for in循环变量为null和undefined会报错
    for in循环对象时,返回的是所有能够通过对象访问的、可枚举的的属性,既包括存在于实例中的属性,也包括存在于原型中的属性。hasOwnProperty只能获取自定义属性,无法获取原型链属性。

###js ajax和跨域 正在完善中

jsbox's People

Contributors

keenw avatar qiuziscorpio avatar

Stargazers

青木蚂蚁 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.