Jump to content


Photo

Dúvidas De Um Código


  • Faça o login para participar
1 reply to this topic

#1 Hagen

Hagen

    Novato no fórum

  • Usuários
  • 10 posts
  • Sexo:Não informado

Posted 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;
}


#2 Klaus

Klaus

    @ ubuntu jaunty

  • Ex-Admins
  • 7924 posts
  • Sexo:Masculino
  • Localidade:127.0.0.1

Posted 16/01/2006, 06:05

Isso é a mesma coisa que:

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


Klaus Paiva
Conheça também: Taperás




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq