hello!i will try to explain my problem here!forgive me from mu english
i want to create buttons depented on some field in mysql.i managed to pass the variable value (how many buttons to make) with php and javascript.Now i want for each button to show some data from mysql(i guess i should call a fun with button parameter to do this) my problem is how to make each button act deferently?i try this
and i call in body
how can i make each button to call a function with maybe some parameter to show my results ? i also tried to modify above function
but with this when page is loaded it call tha function automatically without pressing the buttons.Sorry for the long length article but i try to explain my problem! tnx ina advance
i want to create buttons depented on some field in mysql.i managed to pass the variable value (how many buttons to make) with php and javascript.Now i want for each button to show some data from mysql(i guess i should call a fun with button parameter to do this) my problem is how to make each button act deferently?i try this
Code:
function addsubmit (fid)
{ for (i=0;i<num;i++){ //num is how many buttons to create
var newsubmit = document.createElement("input");
newsubmit.type = "submit";
newsubmit.id = "mysubmit"&+submitCount;
newsubmit.name = "mysubmit";
newsubmit.value =i;
fid.appendChild(newsubmit);
}
}
<body onLoad="return addsubmit(myfor m1)";>how can i make each button to call a function with maybe some parameter to show my results ? i also tried to modify above function
Code:
function addsubmit (fid)
{ for (i=0;i<num;i++){ //num is how many buttons to create
var newsubmit = document.createElement("input");
newsubmit.type = "submit";
newsubmit.id = "mysubmit"&+submitCount;
newsubmit.name = "mysubmit";
newsubmit.value =i;
[B]newsubmit.onclick =fun(i);[/B]
fid.appendChild(newsubmit);
}
}
Comment