Jump to content


Hagen

Member Since 17/10/2004
Offline Last Active 24/08/2006, 10:55
-----

Topics I've Started

Dúvidas De Um Código

11/01/2006, 11:17

Estava vendo o código abaixo simplesmente como estudo, porém não entendi a seguinte linha:
this.ie4 = this.ie5 = this.ie55 = this.ie6 = false;
Ela está meio q separada do código pra facilitar o encontro.
Só gostaria de saber pq tantos iguais(=) assim na mesma linha.
vlw!
function browser () {
  var b = navigator.appName;
  var v = this.version = navigator.appVersion;
  var ua = navigator.userAgent.toLowerCase();
  this.v = parseInt(v);
  this.safari = ua.indexOf("safari")>-1; // always check for safari & opera
  this.opera = ua.indexOf("opera")>-1; // before ns or ie
  this.ns = !this.opera && !this.safari && (b=="Netscape");
  this.ie = !this.opera && (b=="Microsoft Internet Explorer");
  this.gecko = ua.indexOf('gecko')>-1; // check for gecko engine
  if (this.ns) {
    this.ns4 = (this.v==4);
    this.ns6 = (this.v>=5);
    this.b = "Netscape";
  }else if (this.ie) {

                                 this.ie4 = this.ie5 = this.ie55 = this.ie6 = false;

    if (v.indexOf('MSIE 4')>0) {this.ie4 = true; this.v = 4;}
    else if (v.indexOf('MSIE 5')>0) {this.ie5 = true; this.v = 5;}
    else if (v.indexOf('MSIE 5.5')>0) {this.ie55 = true; this.v = 5.5;}
    else if (v.indexOf('MSIE 6')>0) {this.ie6 = true; this.v = 6;}
    this.b = "MSIE";
  }else if (this.opera) {
    this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); // set opera version
    this.opera6=(this.v>=6);
    this.opera7=(this.v>=7);
    this.b = "Opera";
  }else if (this.safari) {
    this.ns6 = (this.v>=5); // ns6 compatible correct?
    this.b = "Safari";
  }
  this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false;
  this.def = (this.ie||this.dom);
  this.win32 = ua.indexOf("win")>-1;
  this.mac = ua.indexOf("mac")>-1;
  this.other = (!this.win32 && !this.mac);
  this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false;
}

Tem Como?

06/04/2005, 13:41

Gostaria de saber se tem como fazer uma função na qual se o objeto número 1 chamá-la, ela aplica o efeito ou a ação apenas no objeto que acionou ela (o número 1).
E se o objeto número 2 chamá-la, o efeito se aplicará apenas ao número 2.
Queria de saber o método de fazer issu pq num manjo muito de javascript.
vlw

IPB Skin By Virteq