![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 風 ![]()
![]() |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title> </title> <script type="text/javascript" src="//www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['table']}); </script> <script type="text/javascript"> var isFirstTime = true; var options = {'showRowNumber': true}; var data; var queryInput; // To see the data that this visualization uses, browse to // http://spreadsheets.google.com/pub?key=rYQm6lTXPH8dHA6XGhJVFsA var query = new google.visualization.Query( 'http://spreadsheets.google.com/tq?key=rYQm6lTXPH8dHA6XGhJVFsA&pub=1'); function sendAndDraw() { // Send the query with a callback function. query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } data = response.getDataTable(); var table = new google.visualization.Table(document.getElementById('table')); table.draw(data, {'showRowNumber': true}); if (isFirstTime) { init(); } } function setQuery(queryString) { // Query language examples configured with the UI query.setQuery(queryString); sendAndDraw(); queryInput.value = queryString; } google.setOnLoadCallback(sendAndDraw); function init() { isFirstTime = (new google.visualization.Table(document.getElementById('table-2'))).draw(data, options); queryInput = document.getElementById('display-query'); } function setQueryFromUser() { setQuery(queryInput.value); } </script> </tr> </table> </form> </div> <tr> </td> <td></td> <div style='font-size: 15px; font-weight: bold; padding: 5px;'> <tr style='font-size: 20px;'> <td>ID <input slect="slect where A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P" style="width: 100" id='display-query' ' /> </td> <tr style='font-size: 20px;'> <input type="button" value='查詢' onclick="setQueryFromUser()" /> </div> <tr style='font-size: 20px;'> <td>查詢資料</td> <td style="width: 50%; padding: 10px"> <div id="table-2"></div> </td> <td style="width: 50%; padding: 10px; vertical-align: top;"> <div id="table"></div> </td> </tr> </table> </body> </html>
本篇文章發表於2014-04-02 02:10
|