this.options[this.options.selectedIndex].value取不到值

因篇幅有限,只截取部分代码?问题就是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("&nbsp;记录&nbsp;"
                + String.valueOf(page.getCurrentRecord() + 1)
                + "&nbsp;到&nbsp;"
                + (String
                        .valueOf((page.getCurrentPage()
                                * page.getPageLength() > page
                                .getTotalRecord()) ? page.getTotalRecord()
                                : page.getCurrentPage()
                                        * page.getPageLength())));
        buf.append("&nbsp;<img src=\"images/First.gif\" onclick=\"window.location.href='"
                        + this.path + "&page=1'\"/>&nbsp;");
        if (page.getCurrentPage() > 1) {
            buf.append("<img src=\"images/Previous.gif\" onclick=\"window.location.href='"
                            + this.path
                            + "&page="
                            + String.valueOf(page.getCurrentPage() - 1)
                            + "'\">&nbsp;");
        }
        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)
                            + "'\">&nbsp;");
        }
        if (page.getCurrentPage() < page.getTotalPage()) {
            buf.append("<img src=\"images/Next.gif\" onclick=\"window.location.href='"
                            + this.path
                            + "&page="
                            + String.valueOf(page.getCurrentPage() + 1)
                            + "'\">&nbsp;");
        }
        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)
                            + "'\">&nbsp;");
        }
        buf.append("<img src=\"images/Last.gif\" onclick=\"window.location.href='"
                        + this.path
                        + "&page="
                        + String.valueOf(page.getTotalPage())
                        + "'\"/>&nbsp;");
        buf.append("<select name=\"yema\" onchange=\"window.location.href='"
                        + this.path + "&page=this.options[this.options.selectedIndex].value'\"/>&nbsp;");//这个地方的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();
}

[code="java"]
private String getHtmlPager(Pager page) {

StringBuffer buf = new StringBuffer();
if (page.getTotalPage() > 0) {
buf.append("

");
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("" + i + ""); } buf.append(""); buf.append("
"); } return buf.toString(); } [/code]

你在构造javascript的时候,语法不对。

"location.href=[b][color=red]'[/color][/b]"+this.path+
"&page=[b][color=red]'+[/color][/b]this.options[this.options.selectedIndex].value/> ");

就可以了。注意,得到所选index也是通过对象操作,你这么写,只能当作常量

应该是 this.options[this.selectedIndex].value