KATOH Yasufumi
karma****@users*****
2007年 1月 15日 (月) 19:07:14 JST
Update of /cvsroot/pal/jstock/src/main/webapp/WEB-INF/jsp In directory sf-cvs:/tmp/cvs-serv13089/src/main/webapp/WEB-INF/jsp Modified Files: view_ajax.jsp jsFunctions.jsp Log Message: JStockAjax Portlet $B$N3t2A>pJsI=<($rF0E*$K9T$&$h$&$K$9$kItJ,$N%P%0=$@5!%(B jstock/src/main/webapp/WEB-INF/jsp/view_ajax.jsp 1.2 -> 1.3 (modified) http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/pal/jstock/src/main/webapp/WEB-INF/jsp/view_ajax.jsp.diff?r1=1.2&r2=1.3 jstock/src/main/webapp/WEB-INF/jsp/jsFunctions.jsp 1.3 -> 1.4 (modified) http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/pal/jstock/src/main/webapp/WEB-INF/jsp/jsFunctions.jsp.diff?r1=1.3&r2=1.4 =================================================================== RCS file: jstock/src/main/webapp/WEB-INF/jsp/view_ajax.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- view_ajax.jsp 2007/01/10 11:42:45 1.2 +++ view_ajax.jsp 2007/01/15 10:07:14 1.3 @@ -25,26 +25,16 @@ <jsp:include page="/WEB-INF/jsp/jsFunctions.jsp" /> <table width="100%" id="<portlet:namespace />tbl"> + <thead> <tr class="portlet-section-subheader"> <th>åå</th> <th id="<portlet:namespace />pricetitle">$B8=:_CM(B</th> <th>$BA0F|Hf(B</th> <th>æå»</th> </tr> - <!-- - <tr class="portlet-section-body"> - <td id="<portlet:namespace />name0">$BF|7PJ?6Q(B</td> - <td id="<portlet:namespace />price0">20000</td> - <td id="<portlet:namespace />change0">+1000</td> - <td id="<portlet:namespace />time0">15:00</td> - </tr> - <tr class="portlet-section-body"> - <td id="<portlet:namespace />name1">$BF|7PJ?6Q(B</td> - <td id="<portlet:namespace />price1">20000</td> - <td id="<portlet:namespace />change1">+1000</td> - <td id="<portlet:namespace />time1">15:00</td> - </tr> - --> + </thead> + <tbody id="<portlet:namespace />tblbody"> + </tbody> </table> </f:view> \ No newline at end of file =================================================================== RCS file: jstock/src/main/webapp/WEB-INF/jsp/jsFunctions.jsp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jsFunctions.jsp 2007/01/10 11:42:45 1.3 +++ jsFunctions.jsp 2007/01/15 10:07:14 1.4 @@ -23,31 +23,40 @@ function <portlet:namespace />displayStockData(response) { -// for (i = 0; i < response.length; i++) { -// var stock = response[i]; -// document.getElementById("<portlet:namespace />name" + i.toString()).innerHTML = stock.name; -// document.getElementById("<portlet:namespace />price" + i.toString()).innerHTML = stock.price; -// document.getElementById("<portlet:namespace />time" + i.toString()).innerHTML = stock.time; -// if (stock.priceUp == true) { -// document.getElementById("<portlet:namespace />change" + i.toString()).style.color = "red"; -// document.getElementById("<portlet:namespace />change" + i.toString()).innerHTML = '+' + stock.change; -// } else { -// document.getElementById("<portlet:namespace />change" + i.toString()).style.color = "green"; -// document.getElementById("<portlet:namespace />change" + i.toString()).innerHTML = stock.change; -// } -// } var tbl = document.getElementById("<portlet:namespace />tbl"); - var th = tbl.firstChild; + var tbody = document.getElementById("<portlet:namespace />tblbody"); + for (i=0; i < response.length; i++) { - var tr = document.createElement("tr"); - tr.className = "portlet-section-body"; - - var stock = response[i]; - - var name = document.createElement("td"); - var price = document.createElement("td"); - var change = document.createElement("td"); - var time = document.createElement("td"); + + var stock = response[i]; + var tr = document.getElementById("<portlet:namespace />tblbody" + i); + + if (tr == null) { + var tr = document.createElement("tr"); + tr.className = "portlet-section-body"; + tr.id = "<portlet:namespace />tblbody" + i; + + var name = document.createElement("td"); + name.id = "<portlet:namespace />name" + i; + var price = document.createElement("td"); + price.id = "<portlet:namespace />price" + i; + var change = document.createElement("td"); + change.id = "<portlet:namespace />change" + i; + var time = document.createElement("td"); + time.id = "<portlet:namespace />time" + i; + + tr.appendChild(name); + tr.appendChild(price); + tr.appendChild(change); + tr.appendChild(time); + + tbody.appendChild(tr); + } else { + name = document.getElementById("<portlet:namespace />name" + i); + price = document.getElementById("<portlet:namespace />price" + i); + change = document.getElementById("<portlet:namespace />change" + i); + time = document.getElementById("<portlet:namespace />time" + i); + } name.innerHTML = stock.name; price.innerHTML = stock.price; @@ -59,13 +68,7 @@ } else { change.style.color = "green"; } - - tr.appendChild(name); - tr.appendChild(price); - tr.appendChild(change); - tr.appendChild(time); - - tbl.appendChild(tr); + } }