的Javascript
<script>
function addmultiple(param1)
{
alert(param1);
}
</script>
調用功能
<script>
function insertData()
{
//create an two dimensional array to store data
var arr1= [[1,'john',39,200,'insert'],[2,'peter',30,300,'insert']];
//addmultiple(1,'john',39,200,'insert'); //for single row
//loop here for passing multiple rows
for(var i=0;i<arr1.length;i++)
{
var row='';
for(var j=0;j<5;j++)
{
row = row + ',' + arr1[i][j];
}
addmultiple(row);
}
}
</script>
HTML代碼
<input type="button" value="b1" onclick="insertData();">
你可以發表你已經嘗試過嗎? – 2013-02-21 04:05:01
不知道你要問什麼,但你可以通過許多參數你想要JS功能,只需在每個參數 – Breezer 2013-02-21 04:05:14
@ brwwzer後面加一個逗號,我可以通過分隔逗號來傳遞多個參數,對於例如:m1 ,mensred,1,1200,1,0,0; M1,mensred,1,1200,1,0,0; M1,mensred,1,1200,1,0,0; M1,mensred,1,1200,1 ,0,0; M1,mensred,1,1200,1,0,0;像這樣我有15個值,我怎麼可以將這15個值傳遞給單個參數 – 2013-02-21 04:40:53