0
我正在嘗試製作月份的下拉列表。當用戶選擇一個月份時,javascript用選定的值填充setter。現在我想使用上面的那個值。因此,我用「Onchange」動作圍繞我的選擇製作了一個表格,並使用getMaand調用所選的月份。Dropdownlist獲取ddl值並在上面使用它
表單有什麼問題嗎?因爲當我在評論中提到這個時候,我會在下拉列表中看到幾個月,當我將它放在代碼中時,他每個月都會打印一行。
我不是Java專家,在表單和選擇中使用Onchange是否正確?
int m = -1;
HTMLCode += "<form onchange=\"window.open('availability.jsp?user=99&clickeddate="+dateFormat.format(today.getTime())+"&month=" + avail.getMaand() + "','_self')\"";
HTMLCode += "<select onchange='javascript:setMonth(\"" + m + "\");'>";
for (m=today.get(Calendar.MONTH); m<12; m++){
if(month == m)
HTMLCode += "<option value='" + m + "' selected>" + maand_voluit[m]+ "</option>";
else
HTMLCode += "<option value='" + m + "'>" + maand_voluit[m] + "</option>";
}
HTMLCode += "</select>";
HTMLCode += "</form>";
親切的問候
你使用什麼是什麼呢? Servlet的? JSP?搖擺? – ajduke
Servlets ....... – user2206834
[Combining Form and Select]的可能重複(http://stackoverflow.com/questions/16011665/combining-form-and-select) – fglez