AlexCyber
24-05-2007, 20:15
allora ho questo script
function crea(obj, k ) {
alert(obj+' '+k)
}
function init(){
big = document.getElementById('big');
container=document.getElementById('galleria');
links=container.getElementsByTagName('a');
for(var k=0,l=links.length;k<l;k++){
links[k].onclick=function(){
return crea(this.href, k );
}
}
}
window.onload = init;
in poche parole come posso passare la variabile k alla funzione crea dopo che è avvenuti onclick?
sono ore che ci sbatto la testa :dhò:
ciao e grazie
function crea(obj, k ) {
alert(obj+' '+k)
}
function init(){
big = document.getElementById('big');
container=document.getElementById('galleria');
links=container.getElementsByTagName('a');
for(var k=0,l=links.length;k<l;k++){
links[k].onclick=function(){
return crea(this.href, k );
}
}
}
window.onload = init;
in poche parole come posso passare la variabile k alla funzione crea dopo che è avvenuti onclick?
sono ore che ci sbatto la testa :dhò:
ciao e grazie