latest #10
鈕釦💚💜豆皮壽司
4 weeks ago @Edit 4 weeks ago
// 連結HTML

function doGet(){
var html=HtmlService.createTemplateFromFile("search");
var check=html.evaluate();
var show =check.setXFrameOptionsMode(Htm1Service.XFrameOptionsMode.ALLOLLOWALL);
return show;
}
鈕釦💚💜豆皮壽司
4 weeks ago @Edit 4 weeks ago
// 處理表單資訊

function submitForm(formObject){
var result = "";
if (formObject.searchtext){
result = search(form0bject.searchtext);
}
return result;
}
鈕釦💚💜豆皮壽司
4 weeks ago @Edit 3 weeks ago
// 搜尋試算表裡的內容

function search(searchtext) {
var spreadsheetId = '';
var dataRage = 'Sheet1!A2:E' ;
var data = Sheets.Spreadsheets.Values.get(spreadsheetId, dataRage).values;

var ar = [];
data.forEach(function(f) {
if (~f.indexOf(searchtext) ) {
ar . push (f) ;
}
} ) : return ar; }
立即下載
鈕釦💚💜豆皮壽司
4 weeks ago @Edit 3 weeks ago
https://images.plurk.com/1VqbLOpIjaqy3SBWBXPJ0O.png https://images.plurk.com/6GCC80A8ISPF2rbzGc196Z.png
Visual Studio Code
鈕釦💚💜豆皮壽司
3 weeks ago @Edit 3 weeks ago
<!連結Bootstrap>

<link href="https://cdn.jsdelivr.net... rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
鈕釦💚💜豆皮壽司
3 weeks ago @Edit 3 weeks ago
<br>
<br>
<h3 style="text-align: center;">標題</h3>
<br>
<!搜尋表單>

<div class="container">
<div class="row">
<form id="search-form" class="form-inline">
<input style="width:80%" type="text" id="searchtext" name="searchtext" placeholder="關鍵字">
<button type="submit" class="btn btn-primary">搜尋</button>
</form> </div> </div>
// 避免表單有空白錯誤

function preventFormSubmit() {
var forms = document.querySelectorAll('form');
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener( 'submit', function(event) {
event.preventDefault();
} );
}
}
window.addEventListener("load", preventFormSubmit, true);
back to top