0
在下面的代碼中有兩個函數:OppSelect()函數調用另一個函數,即exOpp()。現在,如何獲得OppSelect()的「結果」值爲「exOpp()」函數並追加到url?請幫忙。如何將字符串結果追加到javascript函數中的servlet URL
JS:
function exOpp() {
alert("inside");
document.forms[0].action = "/Mgmt/ExportOpp?loadData=xls&customerprofile=" + $customerIDH + "&role=" + $roleIDH + "&targetDate=" + $targetDateH + "&actualDate=" + $actualDateH;
document.forms[0].submit();
}
function OppSelect() {
var menu = document.getElementById('selectedServersID').length;
alert(menu);
var result = "";
for (var i = 0; i < menu; i++) {
var selectedcol = document.getElementById('selectedServersID')[i].value;
//var selectedcol = document.getElementById('selectedServersID')[i].innerHTML;
// alert(selectedcol);
if (i > 0) {
result += ',';
}
result += selectedcol;
}
alert(result);
exOpp();
}
嗨,感謝您的回答..如何將數據追加到document.forms [0] .action =「/ Mgmt/ExportOpp?loadData = xls&customerprofile =」+ $ customerIDH +「&role =」+ $ roleIDH +「&targetDate =」+ $ targetDateH +「&act ualDate =「+ $ actualDateH; ? – 123HIS
因爲你已經添加了「&role =」+ $ roleIDH +你可以像這樣添加「&role =」+ urldata +到你需要傳遞的值中的任何一個參數。 – codebreaker