可是一邊看文章,心裡就OS覺得,只是要顯示標題列有必要搞的這麼麻煩嗎?(我承認我懶...程度又很低落...)
所以自己想了另一個非常沒有技術的方法實現這個功能,請往下看... :D
'首先將查詢出來的table塞到date table
HTML DOM 中文說明網頁:
https://www.w3school.com.cn/js/js_htmldom.asp
簡體網站,內容蠻多的,有參考價值,對於英文感冒的人應該很好用。
HTML DOM 英文說明網頁:
https://www.w3schools.com/js/js_htmldom.asp
這篇文章是參考:http://www.dotblogs.com.tw/puma/archive/2008/09/03/5288.aspx修改後而成。
.js file:
function openWindowWithPost(url, name, keys, values) { //開新視窗,這邊我不指定新視窗的網址 var newWindow = window.open("", name, "height=700, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no"); if (!newWindow) return false; var html = ""; html += "<html><head></head><body><form id='formid' method='post' action='" + url + "'>"; if (keys && values && (keys.length == values.length)) for (var i = 0; i < keys.length; i++) html += "<input type='hidden' name='" + keys[i] + "' value='" + values[i] + "'/>"; html += "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>"; newWindow.document.write(html); return newWindow; } function Post(url) { //這個function會把網頁中所有的form找出來,並且找出每個form所包含的elements var keys = []; var values = []; for (var i = 0; i < document.forms.length; i++) { for (var j = 0; j < document.forms[i].elements.length; j++) { if (document.forms[i].elements[j].name != undefined && document.forms[i].elements[j].value != undefined) { keys[keys.length] = document.forms[i].elements[j].name; values[values.length] = document.forms[i].elements[j].value; } } } openWindowWithPost(url, "網頁標題", keys, values); }
.aspx file:
<form...> <input...> <input...> <input...> </form> <input type="button" value="Post" onclick="Post('處理POST資料的ASPX網頁');" />
很多時候,二個人生活比一個人過日子還要辛苦。
一個人的時候,想去哪裡就去哪裡,想和誰出去就和誰出去,
不必為了男朋友今天被老闆罵了 心情不好 需要人陪 而犧牲和好友的聚會,
也不需要因為女朋友感冒發高燒 需要照顧 而犧牲早上重要會議。