閑來無事,寫個簡單的js類,高手別看了~B("id名").Method 挺簡單的,下面的方法名,已經給出方法的作用了,就不做解釋了,直接拿去用吧!
{
this.style.display='none'; document.getElementById('Code_Closed_Text_050811').style.display='none'; document.getElementById('Code_Open_Image_050811').style.display='inline'; document.getElementById('Code_Open_Text_050811').style.display='inline';
}" id="Code_Closed_Image_050811" style="display: none">{
this.style.display='none'; document.getElementById('Code_Open_Text_050811').style.display='none'; getElementById('Code_Closed_Image_050811').style.display='inline'; getElementById('Code_Closed_Text_050811').style.display='inline';
}" id="Code_Open_Image_050811">Code
function P(E)
{
var N = "";
this.Z = document.getElementById(E);
this.val = function(){
if(arguments.length==0)
{
return this.Z.value;
}
else if(arguments.length=1)
{
this.Z.value = arguments[0];
}
}
this.appendValAfter = function(){
this.Z.value = this.val() + arguments[0];
}
this.appendValBefore = function(){
this.Z.value = arguments[0] + this.val();
}
this.html = function(){
if(arguments.length==0)
{
return this.Z.innerHTML;
}
else if(arguments.length = 1)
{
this.Z.innerHTML = arguments[0];
}
}
this.appendHtmlAfter = function(){
this.Z.innerHTML = this.html() + arguments[0];
}
this.appendHtmlBefore = function(){
this.Z.innerHTML = arguments[0] + this.html();
}
this.hide = function(){ this.Z.style.display = "none";}
this.show = function(){ this.Z.style.display = "inline-block";}
this.clearV = function(){ this.Z.value = N;}
this.clearH = function(){this.Z.innerHTML = N;}
this.toggle = function(){
var S = this.Z.style; S.display=="inline-block"?S.display="none":S.display="inline-block";
}
//this.css = function(){ return this.Z.css}
}
//o.prototype.GV =
function B(E){
return (new P(E));
}