//呼叫資料庫資料 function loadXmlData2() { var xmlfile = 'comment.xml.php'; var pageNum_Recordset2 = document.getElementById("pageNum_Recordset2"); downloadUrl(xmlfile+"?pageNum_Recordset2="+pageNum_Recordset2.value, function(data) { var pagecontrol2 = document.getElementById("pagecontrol2"); var comment = data.documentElement.getElementsByTagName("comment");//獲取comment節點 var startrecord2 = parseInt(comment[0].getAttribute("startRow_Recordset1"))+1; var endrecord2 = 0; if((parseInt(comment[0].getAttribute("startRow_Recordset1"))+parseInt(comment[0].getAttribute("maxRows_Recordset1")))<(parseInt(comment[0].getAttribute("totalRows_Recordset1")))){ endrecord2 = parseInt(comment[0].getAttribute("startRow_Recordset1"))+parseInt(comment[0].getAttribute("maxRows_Recordset1")); tourist = tourist + ' '; }else{ endrecord2 = parseInt(comment[0].getAttribute("totalRows_Recordset1")); } var tourist1 = "The "+startrecord2+" ~ "+endrecord2+" Records,Total "+comment[0].getAttribute("totalRows_Recordset1")+" Records
"; var tourist2 = "The "+(parseInt(comment[0].getAttribute("pageNum_Recordset2"))+1)+" Page,Total "+(parseInt(comment[0].getAttribute("totalPages_Recordset1"))+1)+" Page"; if(parseInt(comment[0].getAttribute("pageNum_Recordset2"))>0){ tourist2 = ' ' + tourist2; } if((parseInt(comment[0].getAttribute("startRow_Recordset1"))+parseInt(comment[0].getAttribute("maxRows_Recordset1")))<(parseInt(comment[0].getAttribute("totalRows_Recordset1")))){ tourist2 = tourist2 + ' '; } var tourist = tourist1 + tourist2 pagecontrol2.innerHTML = tourist; // 處理每一個comment節點 cleardatasheet2(); for (var i = 1; i < comment.length; i++) { addComments(comment[i],i); } $(document).ready(function(){ $("a[rel^='prettyPhoto']").prettyPhoto(); }); }); } //載入Comment紀錄 function addComments(node,j) { var CommentDate = node.getAttribute("comment_update"); var resight_sn = node.getAttribute("resight_sn"); var resight_date = node.getAttribute("resight_date"); var comment_user = node.getAttribute("comment_user"); var comment_content = node.getAttribute("comment_content"); var location = node.getAttribute("location"); var birdname = node.getAttribute("birdname"); var region = node.getAttribute("region"); //插入紀錄表 var Table = document.getElementById("comment"); var j=Table.rows.length; Cell = new Array(7); Cell[0] = ""+resight_sn+""; Cell[1] = ''+birdname+''; Cell[2] = ''+resight_date+'
'; Cell[3] = ''; Cell[4] = region; Cell[5] = location; Cell[6] = '
'+comment_content+'
by '+comment_user+' on '+CommentDate+'
'; newRow = Table.insertRow(-1); newRow.setAttribute("align","center"); for(var k=0;k<7;k++){ newcell = newRow.insertCell(-1); newcell.innerHTML = Cell[k]; if((k==0)){newcell.setAttribute("nowrap",true);} if((k==4)){newcell.setAttribute("align",'center');} } } function cleardatasheet2(){ var Table = document.getElementById("comment"); var j=Table.rows.length; for(var i=0;i