HighDots Forums  

uso di setAttribute

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


Discuss uso di setAttribute in the Javascript (Italian) forum.



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

Default uso di setAttribute - 04-13-2005 , 04:17 PM






Ciao a tutti,

mi trovo in un tag <tr>html
e vorrei settare un attributo ottenuto attraverso una funzione. Vi posto un
pò di codice:

<tr class="%=classtd">
<script language ="JavaScript">
var dataInizio = "25/12/2005";
var dataFine = "27/12/2005";

var lassoDiTempo = FunzioneDifferenza(dataInizio,dataFine);
</script>
</tr>

a livello di questo tag tr vorrei definire un attibuto sortValue =
lassoDiTempo.
Le ho provare tutte tipo this.setAttribute("sortValue", lassoDiTempo) e
document.write('<sortValue = ' + lassoDiTempo +'/>' ) ma non ha funzionato.
Chi mi illumina?

ciao e grazie per l'attenzione

Domenico



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

Default Re: uso di setAttribute - 04-14-2005 , 03:27 AM






In data Wed, 13 Apr 2005 20:17:12 GMT, Domenico Rella ha scritto:

Quote:
a livello di questo tag tr vorrei definire un attibuto sortValue =
lassoDiTempo.
Le ho provare tutte tipo this.setAttribute("sortValue", lassoDiTempo) e
document.write('<sortValue = ' + lassoDiTempo +'/>' ) ma non ha funzionato.
this non ha senso in questo contesto: si riferisce all'oggetto stesso, ma
nello script non hai oggetti che scatenano un evento o chiamano una
function.

Quote:
Chi mi illumina?
un qualcosa del tipo
window.onload=function() {
document.getElementById('id_della_tua_tr').setAttr ibute("sortValue",lassoDiTempo);
}

p.s. sei consapevole che Opera lo ignorerà?

--
"Emancipate yourselves from mental slavery;
None but ourselves can free our minds"
B.M.


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 - 2008, Jelsoft Enterprises Ltd.