JSP的疑問 |
尚未結案
|
369122436
一般會員 發表:1 回覆:0 積分:0 註冊:2008-04-26 發送簡訊給我 |
...
<% Integer aa = (Integer)session.getAttribute("aa"); int a = 0; if(aa != null) a = aa.intValue(); out.println("<input type='text' name='input'/>"); out.println("<input type='submit' value='submit'/>"); out.print(a); String input = request.getParameter("input"); if (input != null) { int in = Integer.parseInt(input); session.setAttribute("aa", new Integer(in)); } %> ... 當輸入一個數之後,右面便會顯示。 現在入數字按submit,會是下一次submit才變。 1)請問如果可以在輸入數字後,右面的數字會立即起變化?(我想按submit後,右面立即是我輸入的數字)但不要redirect or reload之類,因為有counter. 2)怎樣可以限制到只可輸入數字?(英文、符號、無輸入等會有warning,但不會出現500) 謝謝各位! |
deepred
一般會員 發表:6 回覆:17 積分:4 註冊:2007-08-23 發送簡訊給我 |
|
lcc1299
一般會員 發表:39 回覆:42 積分:21 註冊:2004-09-12 發送簡訊給我 |
===================引 用 369122436 文 章=================== ...
<!--r /> Integer aa = (Integer)session.getAttribute("aa"); int a = 0; if(aa != null) a = aa.intValue(); out.println("<input type='text' name='input' />"); out.println("<input type='submit' value='submit' />"); out.print(a); String input = request.getParameter("input"); if (input != null) { int in = Integer.parseInt(input); session.setAttribute("aa", new Integer(in)); } --> ... 當輸入一個數之後,右面便會顯示。 現在入數字按submit,會是下一次submit才變。 1)請問如果可以在輸入數字後,右面的數字會立即起變化?(我想按submit後,右面立即是我輸入的數字)但不要redirect or reload之類,因為有counter. 2)怎樣可以限制到只可輸入數字?(英文、符號、無輸入等會有warning,但不會出現500) 謝謝各位! 右面??右面??分割窗口嗎??如果是分割窗口的話,那就如下: parent.frame2.location.href="./state.htm"; 那數字就帶在網址列後面過去,在取出來就好了(jsp-getParameter("xxx")) 至於限制嘛!!~~用javascript吧~~如下: if(!((acc.charAt(0)=='a')||(acc.charAt(0)=='b')||(acc.charAt(0)=='c')||(acc.charAt(0)=='d')||(acc.charAt(0)=='e') ||(acc.charAt(0)=='f')||(acc.charAt(0)=='g')||(acc.charAt(0)=='h')||(acc.charAt(0)=='i')||(acc.charAt(0)=='j') 提示正確,答案錯誤,多想多試!!~
編輯記錄
lcc1299 重新編輯於 2008-05-08 23:47:10, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |