/* * === Graphical Simple Button === * * updated 2003/07/05 * * mail : peace@skipup.com * home : http://www.skipup.com/~peace/ */ /** * Image image0 * Image image1 * Function listener * HTMLLinkElement link * HTMLImageElement img */ function class__SimpleButton__() { var classId = Object.getClassName(arguments.callee); /** * コンストラクタ. * SimpleButton(String p0, String p1, int w, int h) * SimpleButton(String p0, String p1, int w, int h, function listener) */ var F = window[ classId ] = function(p0, p1, w, h, listener) { if (this.constructor !== F) this.constructor = F; /** * */ this.image0 = new Image(); this.image0.src = p0; this.image0.width = w; this.image0.height = h; /** * */ this.image1 = new Image(); this.image1.src = p1; this.image1.width = w; this.image1.height = h; /** * */ this.listener = listener !== void 0 ? listener : null; var copyId = classId + new Date().getTime(); var d = window.document; var strThis = "this["" + copyId + ""]"; d.writeln( "", "", "" ); /** * */ this.link = d.links[d.links.length - 1]; /** * */ this.img = d.images[d.images.length - 1]; this.link[copyId] = this; }; var FP = F.prototype; FP.over = function(){ this.img.src = this.image1.src; }; FP.out = function(){ this.img.src = this.image0.src; }; FP.click = function(e){ if(this.listener !== null) return Boolean(this.listener(e, this)); return false; }; FP.toString = function(){ return classId + " : (" + this.image0.src + "," + this.image1.src + ")"; }; } class__SimpleButton__(window);