|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Member
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);} Codice:
function AddRow(row){ alert(row); }
__________________
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 |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Oct 2007
Città: Padova
Messaggi: 4131
|
Non conosco javascript, ma dal codice, se non ho capito male, mi sembra che tu chiami alert() passandogli la variabile "numberRow" che è la variabile che hai usato come un indice, quindi deduco contenga un valore intero; il problema è che alert() ti crea una finestra di alert (appunto) stampando una stringa che prende come parametro di ingresso.
Suppongo che tu passandogli il valore di "numberRow" veda stampato un numero (l'indice); non ho capito invece cosa vorresti vedere? Cioè, quale sarebbe il "contenitore" che viene indicizzato da "numberRow", del quale vorresti stampare il contenuto di una riga? La variabile "tr[]"? |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Nov 2003
Messaggi: 980
|
Prova con
Codice:
address.onchange= function(){ var row = numberRow; AddRow(row); } |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:45.