Discussione: [Javascript+DOM 2]
View Single Post
Old 21-01-2008, 11:30   #1
DarkSun84
Member
 
L'Avatar di DarkSun84
 
Iscritto dal: Oct 2005
Città: Roma
Messaggi: 175
[Javascript+DOM 2]

Rieccomi con un altro problema...
dopo aver definito in html una tabella, tramite un bottone che mi chiama una funzione javascript creo dinamicamente le righe di questa tabella:
Codice:
numberRow=0;

function addHtmlTest() {      //////   HTTP TEST   //////

  numberRow++;

tr[numberRow]=document.createElement('tr'); 
var td0=document.createElement('td');
var td1=document.createElement('td');

td1.setAttribute("id","tdID"+numberRow);

  var td2=document.createElement('td');
  var td3=document.createElement('td');
  var td4=document.createElement('td');

var tdText0= document.createTextNode('HTTP-test');  //  create the text that will go in the table cell
var address= document.createElement('select');
address.setAttribute("id",'addressHttp');           // id access
address.setAttribute("name",'addressHttp'+numberRow);
address.onchange= function(){AddRow(numberRow);}
il problema è che quando chiamo AddRow(numberRow) definita così:
Codice:
function AddRow(row){
alert(row);
}
vorrei che mi stampi il valore relativo alla riga in cui mi trovo e non all'ultimo valore preso da numberRow.
__________________
AN7, Athlon xp2400 @2400MHz, OCZ pc 3700 gold, 6600GT @600MHz, raid0 with seagate, Pioneer DVD-RW DVR-115D, PCTV, Thermaltake Purepower 420W, OCLABS liquid, Gentoo powered. MyCase, Bubble-TraProjex visita il mio sito:
www.ecoglobo.it
DarkSun84 è offline   Rispondi citando il messaggio o parte di esso