首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript批改对象!

2012-11-22 
javascript修改对象!!function StringBuffer(){??? this.__string__new Array()??? }StringBuffer.proto

javascript修改对象!!

function StringBuffer(){
??? this.__string__=new Array();
??? }
StringBuffer.prototype.append=function(str){
??? this.__string__.push(str);
??? }???
StringBuffer.prototype.join=function(){
??? return this.__string__.join("");
??? }???
var str1=new StringBuffer();
str1.append("4");
str1.append("2");

alert(parseInt(str1.join()).toString(16));

?

//给ES中的每个本地对象添加新方法
Object.prototype.ShowValue=function(){
??? return this.valueOf();
??? }
??? var s=111;
alert(s.ShowValue());???

热点排行
Bad Request.