Skip to Main Content
建構Android應用程式--使用HTML、CSS和JavaScript 第二版
book

建構Android應用程式--使用HTML、CSS和JavaScript 第二版

by Jonathan Stark, Brian Jepson
May 2012
Intermediate to advanced content levelIntermediate to advanced
176 pages
3h 43m
Chinese
GoTop Information, Inc.
Content preview from 建構Android應用程式--使用HTML、CSS和JavaScript 第二版
客戶端資料儲存
97
5-6
:加入
CSS
後的資料列
刪除資料列
要讓
Delete
按鈕在被點擊時能做點事,我們需要以
jQuery
將點擊事件處理常式繫結至
Delete
按鈕。
可惜,在此處這種做法行不通。和
Dates
面板上的項目不同的是,
Date
面板上的資料項並
非靜態的。也就是說,那些資料項會在使用者的期程(
session
)中被新增或移除。事實上,
當應用程式啟動時,
Date
面板上沒有資料項可看。因此,啟動時,我們沒有東西可以和
click
事件連結起來。
98
第五章
解決方法是在
refreshEntries()
函式建立刪除按鈕時,把點擊事件連結上去。為此,要
把下列粗體列加至
for
迴圈尾端:
...
newEntryRow.find('.calories').text(row.calories);
newEntryRow.find('.delete').click(function(){
var clickedEntry = $(this).parent();
var clickedEntryId = clickedEntry.data('entryId');
deleteEntryById(clickedEntryId);
clickedEntry.slideUp(); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

大模型应用开发极简入门 : 基于GPT-4和ChatGPT

大模型应用开发极简入门 : 基于GPT-4和ChatGPT

Olivier Caelen, Marie-Alice Blete
HBase管理指南

HBase管理指南

Posts & Telecom Press, Yifeng Jiang
自然语言处理与计算语言学

自然语言处理与计算语言学

Posts & Telecom Press, Bhargav Srinivasa-Desikan

Publisher Resources

ISBN: 9789862764817