因篇幅有限,只截取部分代码?问题就是this.options[this.options.selectedIndex].value取不到值,这是为什么呢?
private String getHtmlPager(Pager page) {
StringBuffer buf = new StringBuffer();
if (page.getTotalPage() > 0) {
buf.append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"right\">");
buf.append("第" + String.valueOf(page.getCurrentPage()) + "页/共"
+ String.valueOf(page.getTotalPage()) + "页");
buf.append(" 记录 "
+ String.valueOf(page.getCurrentRecord() + 1)
+ " 到 "
+ (String
.valueOf((page.getCurrentPage()
* page.getPageLength() > page
.getTotalRecord()) ? page.getTotalRecord()
: page.getCurrentPage()
* page.getPageLength())));
buf.append(" <img src=\"images/First.gif\" onclick=\"window.location.href='"
+ this.path + "&page=1'\"/> ");
if (page.getCurrentPage() > 1) {
buf.append("<img src=\"images/Previous.gif\" onclick=\"window.location.href='"
+ this.path
+ "&page="
+ String.valueOf(page.getCurrentPage() - 1)
+ "'\"> ");
}
if (page.getCurrentPage() <= 1) {
buf.append("<img src=\"images/Previous.gif\" disabled=\"true\" onclick=\"window.location.href='"
+ this.path
+ "&page="
+ String.valueOf(page.getCurrentPage() - 1)
+ "'\"> ");
}
if (page.getCurrentPage() < page.getTotalPage()) {
buf.append("<img src=\"images/Next.gif\" onclick=\"window.location.href='"
+ this.path
+ "&page="
+ String.valueOf(page.getCurrentPage() + 1)
+ "'\"> ");
}
if (page.getCurrentPage() >= page.getTotalPage()) {
buf.append("<img src=\"images/Next.gif\" disabled=\"true\" onclick=\"window.location.href='"
+ this.path
+ "&page="
+ String.valueOf(page.getCurrentPage() + 1)
+ "'\"> ");
}
buf.append("<img src=\"images/Last.gif\" onclick=\"window.location.href='"
+ this.path
+ "&page="
+ String.valueOf(page.getTotalPage())
+ "'\"/> ");
buf.append("<select name=\"yema\" onchange=\"window.location.href='"
+ this.path + "&page=this.options[this.options.selectedIndex].value'\"/> ");//这个地方的page取不到值.为什么?怎么解决?
for (int i = 1; i <= page.getTotalPage(); i++) {
buf.append("<option value =\"" + i +"\" >" + i + "</option>");
}
buf.append("</select>");
buf.append("</td></tr></table>");
}
return buf.toString();
}