HighDots Forums  

setAttribute: Cross browser IE7 e IE8

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss setAttribute: Cross browser IE7 e IE8 in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fruntein
 
Posts: n/a

Default setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 05:16 AM






Con IE7 funziona:
setAttribute("className","alfa");
Con IE8:
setAttribute("class","alfa");

Come posso controllare questa differenza senza far ricorso al
riconoscimento del browser?
Ho pensato a

if(document.getElementById(Wind).getAttribute("cla ssName")===null){
setAttribute("class","alfa");
}else{
setAttribute("className","alfa");
}

Ma questo non funzionerebbe se className non fosse inizialmente definito.

Reply With Quote
  #2  
Old   
Cristiano Larghi
 
Posts: n/a

Default Re: setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 05:53 AM






Il Sun, 25 Oct 2009 10:16:54 +0100, Fruntein ha scritto:

Quote:
Con IE7 funziona:
setAttribute("className","alfa");
Con IE8:
setAttribute("class","alfa");
tuooggetto.className="alfa";

Reply With Quote
  #3  
Old   
Fruntein
 
Posts: n/a

Default Re: setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 06:10 AM



Cristiano Larghi ha scritto quanto segue il 25/10/2009 10.53>
Quote:
Il Sun, 25 Oct 2009 10:16:54 +0100, Fruntein ha scritto:

Con IE7 funziona:
setAttribute("className","alfa");
Con IE8:
setAttribute("class","alfa");

tuooggetto.className="alfa";
Che strano sto IE.
Digerisge className applicato all'oggetto ma non con setAttribute.
Comunque con setAttribute non si può fare niente?
Grazie.

Reply With Quote
  #4  
Old   
Cristiano Larghi
 
Posts: n/a

Default Re: setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 06:23 AM



Il Sun, 25 Oct 2009 11:10:25 +0100, Fruntein ha scritto:

Quote:
Che strano sto IE.
Digerisge className applicato all'oggetto ma non con setAttribute.
Comunque con setAttribute non si può fare niente? Grazie.
boh ... mai provato, ho sempre usato className che funziona con tutti i
browser (recenti o semi-recenti).

Reply With Quote
  #5  
Old   
Fruntein
 
Posts: n/a

Default Re: setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 06:35 AM



Cristiano Larghi ha scritto quanto segue il 25/10/2009 11.23>
Quote:
Il Sun, 25 Oct 2009 11:10:25 +0100, Fruntein ha scritto:

Che strano sto IE.
Digerisge className applicato all'oggetto ma non con setAttribute.
Comunque con setAttribute non si può fare niente? Grazie.

boh ... mai provato, ho sempre usato className che funziona con tutti i
browser (recenti o semi-recenti).

Non con Google Chrome.

Reply With Quote
  #6  
Old   
Cristiano Larghi
 
Posts: n/a

Default Re: setAttribute: Cross browser IE7 e IE8 - 10-25-2009 , 06:41 AM



Il Sun, 25 Oct 2009 11:35:55 +0100, Fruntein ha scritto:

Quote:
Non con Google Chrome.
non ci credo ... (alla prima occasione provo)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.