我通過JSON在auto.jsp在具有ID文本框接收來自state.jsp數據和顯示數據textbox2.But我不能夠編輯文本框我在哪裏接收數據,爲什麼?可編輯文本框通過JSON
// auto.jsp:
$("#combo1").change(function() {
// by onchange event of combobox, i am displaying string "anyname"
// on that below textbox.
$.getJSON('state.jsp', { combo1Val : $(this).val() }, function(responsedata) {
$("#textbox2").replaceWith(responsedata.name);
});
});
// i am displaying "anyname" here, but why i am not able
// to edit this text box after displaying? I have not set it to readonly
<input type="text" id="textbox2" name="2ndtextbox/>
// state.jsp
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%
JSONObject arrayObj= new JSONObject();
arrayObj.put("name","anyname");// displaying "anyname" in that textbox
response.setContentType("application/json");
response.getWriter().write(arrayObj.toString());
%>
我在文本框中顯示字符串 「anyname」 但我不能夠爲什麼編輯這個文本框?我沒有把它設置爲只讀。任何幫助
非常感謝它的工作 – harry 2012-02-09 10:01:25
很高興幫助。您可以通過點擊此答案旁邊的複選標記來接受安檢。 – 2012-02-09 10:04:13
亞我很接受它,但它是在告訴等待4分鐘以上,可以請你給予好評我的問題 – harry 2012-02-09 10:06:36