
javasciprt
西街恶人
Java Flex Linux Android
展开
-
javascipt全局和局部变量定义
var globe = "111"; function test(){local = "222" ; var local = "333" 注:如果local不加var 进行声明则变成全局变量,否则局部变量。}原创 2014-02-10 21:42:14 · 459 阅读 · 0 评论 -
javascript继承对象冒充方式
function Parent(username){this.username = username;this.sayHello = function(){alert(username );}}function Child(username,pwd){this.method = Parent;this.method (username);原创 2014-02-17 22:29:47 · 594 阅读 · 0 评论 -
通过混合方式显示对象继承
function Parent(hello){this.hello = hello;}Parent.prototype.sayHello = function () {alert(this.hello);};function Child(hello,word){Parent.call(this,hello);this.word = word;}原创 2014-02-17 23:11:40 · 498 阅读 · 0 评论 -
javscript通过原型链方式显示对象继承
function Parent(){}Parent.prototype.hello = "hello";Parent.prototype.sayHello = function(){alert(this.hello);};function Child(){}Child.prototype = new Parent();//扩展原创 2014-02-17 23:05:21 · 566 阅读 · 0 评论 -
使用apply方法现实对象继承
function Parent(username){this.username = username;this.sayHello = function() {alert(this.username);}}function Child(username,pwd){Parent.apply(this,[username])原创 2014-02-17 22:57:15 · 532 阅读 · 0 评论 -
javascript使用call方式实现对象继承
function Parent(username){this.username = username;this.sayHello = function() {alert(this.username);}}function Child(username,pwd){Parent.call(this,username);this.pwd = pwd;thi原创 2014-02-17 22:53:12 · 542 阅读 · 0 评论 -
javaScript动态原型的方式定义对象
function Test(){this.name = "admin";this.pwd = "123";if(typeof == Test.flag == ''undefinded) { Test.prototype.getInfo = function(){}Test.flag = true;}}原创 2014-02-15 22:28:39 · 625 阅读 · 0 评论 -
javascript使用原型(prototype)方法创建对象
function Test() {}Test.prototype.name = "123";Test.prototype.value = "123";Test.prototype.getInfo = function() {}原创 2014-02-13 22:44:32 · 743 阅读 · 0 评论 -
javascript用工厂方法创建对象
function createFactoryObject(){var object = new Object();object.login = "admin";object.pwd = "admin";object.get = function(){ }return object;}var obj1 = createFactoryObject(原创 2014-02-13 22:18:13 · 546 阅读 · 0 评论 -
javascript sort
var array = [1,20.2];array.sort(函数名); //升序排序如果不传函数就默认按照字符串排序原创 2014-02-13 21:49:51 · 488 阅读 · 0 评论 -
javasciprt null和undefined关系
undefined 实际上是从null派生过来的if(undefined == null)等于true;原创 2014-02-12 22:44:08 · 618 阅读 · 0 评论 -
javasciprt数据类型
分为五种:1.undefined2.Null3.Boolean4.String5.Number基本数据类型和对象数据类型var s = "test" //基本var s1 = new String("333") //对象原创 2014-02-12 22:37:56 · 777 阅读 · 0 评论 -
javasciprt强制类型转换
有三种:1. Boolean(value);2. Number(value);1. String(value);翻译 2014-02-12 22:50:13 · 611 阅读 · 0 评论 -
javasciprt cookie类型
两种 类型:1.持久性cookie ,会被存储到客户的的硬盘上2.会话cookie 不会存储到客户的硬盘上,而是放在浏览器进程所处的内存当中,浏览器关系则cookie销毁。原创 2014-02-12 21:38:43 · 509 阅读 · 0 评论 -
javsciprt动态绑定事件
$('#btn').onclick = clickHandler;原创 2014-02-11 22:35:24 · 723 阅读 · 0 评论 -
javasciprt with用法
with 用于调用某个对象的里面的方法或属性,不需要每次都写那个对象用法如下:with(document) {write('111');write('111');write('111');}原创 2014-02-10 22:00:12 · 560 阅读 · 0 评论 -
javscript继承第二种实现call方法
call是Function对象中的方法function test(str){alert(this.name + ","+str);}var o = new Object();o.name = "admin";//调用了test函数test.call(o,"admin123");//将object赋值给我this原创 2014-02-17 22:42:38 · 702 阅读 · 0 评论