반응형

Having fun with HTML5 — Local Storage and Session Storage


API

The full API spec­i­fi­ca­tion for the local­Stor­age and ses­sion­Stor­age objects can be found here. At the time of writ­ing, this is how the com­mon Stor­age inter­face look:

image

Demo

I’ve put together a quick demo here to illus­trate how to detect and use the local and ses­sion stor­age to get, set, remove and clear stored items (well, basi­cally, cov­ers each of the avail­able meth­ods on the Stor­age inter­face above).

The page itself is sim­ple and crude, just a cou­ple of <div> and most impor­tantly two tables which I use to show all the key value pairs stored in the local and ses­sion storage:

image

Intro­duc­ing the new place­holder attribute

You might have noticed that the two text boxes had place­holder text sim­i­lar to that famil­iar search box in Firefox:

text boxes with place holder text Firefox search box

This is done using HTML5’s place­holder attribute for the <input> tag:

1
2
<input id="keyText" placeholder="Enter key"/>
<input id="valueText" placeholder="Enter value"/>

Nice and easy, eh? ;-)

Set­ting an item

To add a new key value pair or update the value asso­ci­ated with an exist­ing key, you just have to call the setItem method on the intended stor­age object:

1
2
3
4
5
6
7
8
9
10
11
12
13
// adds a new key to both local and session storage
function setKey() {
var key = $("#keyText").val();
var value = $("#valueText").val();
if (Modernizr.localstorage) {
localStorage.setItem(key, value);
}
if (Modernizr.sessionstorage) {
sessionStorage.setItem(key, value);
}
showKeys();
}
Remov­ing an item

Ear­lier in the showStorageKeys(type, table) func­tion, I added a row to the rel­e­vant table for each key value pair in the stor­age includ­ing a but­ton with a han­dler for the onclick event. The han­dlers are cre­ated with the cor­rect stor­age type (“local” or “ses­sion”) and key for the cur­rent row baked in already so that they will call the removeItem(type, key) func­tion with the cor­rect parameters:

1
2
3
4
5
6
7
// removes an item with the specified key from the specified type of storage
function removeItem(type, key) {
// get the specified type of storage, i.e. local or session
var storage = window[type + 'Storage'];
storage.removeItem(key);
showKeys();
}
Clear­ing all items

Finally, the ’”Clear” but­tons under­neath the tables call the clear­LocalKeys() and clearS­es­sion­Keys() func­tion to remove all the key value pairs in the cor­re­spond­ing storage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function clearLocalKeys() {
clearKeys("local");
}
function clearSessionKeys() {
clearKeys("session");
}
// clear all the held keys in the specified type of storage
function clearKeys(type) {
// get the specified type of storage, i.e. local or session
var storage = window[type + 'Storage'];
// clear the keys
storage.clear();
showKeys();
}


반응형
반응형
html5, 모바일기기에서 사용가능한 차트. 퓨전차트
http://www.fusioncharts.com/PowerCharts/

PowerCharts

PowerCharts is a set of advanced charting widgets for usage in specialized applications like network diagrams, performance analysis, hierarchical structures, stock prices and financial planning.

  • Render charts in both Flash and JavaScript (HTML5); works with PCs, Macs, iPads, iPhones and a majority of other mobile devices
  • Integrate with any server-side technology (ASP.NET, PHP, ASP, RoR, JSP, ColdFusion etc.) and database
  • Highly interactive capabilities like visually editing data, adding data nodes at runtime and submitting modified data back to server
  • Extensive documentation and samples get you started in minutes
Add the Rich Internet Applications functionality to your web applications with PowerCharts

Chart GalleryDownloadPowerCharts Documentation


Chart Types

PowerCharts offers 16 different chart types each with their own specialized applications:

  1. Drag Node Chart

    Drag Node ChartPowerful diagramming tool for network diagrams & process flow diagrams

  2. Heat Map Chart

    Heat Map ChartTabular representation of complex data with user-defined color ranges

  3. Multi-Axis Line Chart

    Multi-Axis Line ChartAdvanced line chart with multiple axes for comparing multiple parameters

  4. Interactive Candlestick Chart

    Interactive Candlestick ChartHighly interactive chart for plotting stock data and commodity prices

  5. Waterfall Chart

    Waterfall ChartShows the cumulative effect of positive and negative values on an initial value

  6. Drag-able Charts

    Drag-able ChartsOffers visual modification of the plotted data simply by dragging the data plots

  7. Multi-Level Pie Chart

    Multi-Level Pie ChartModern method for displaying hierarchical relationships

  8. Box and Whisker Chart

    Box and Whisker ChartDisplay the spread of a batch of data using median, quartiles, limits, mean and deviations

  9. Logarithmic Charts

    Logarithmic ChartsFor plotting very large and very small values on the same chart on a logarithmic scale

  10. Radar (Spider) Chart

    Radar (Spider) ChartEffective tool for comparing multiple entities based on different features

  11. Spline Charts

    Spline ChartsSimilar to a line chart except that it draws a fitted curve through the data points

  12. Step Line Chart

    Step Line ChartSpecialized line chart with vertical and horizontal lines to connect data points

  13. Select Scatter Chart

    Select Scatter ChartScatter Chart where data points can be visually selected & processed

  14. Inverse Axis Charts

    Inverse Axis ChartsPlot data on an inverted scale, like ranks and race timings

  15. Error Charts

    Error ChartsShows the extent of possible error (or deviation) in data using I-shaped bars

  16. Kagi Chart

    Kagi ChartFor noise free analysis of equity/commodity prices

반응형
반응형
제작하려는 앱유형에 따라서 앱이 유리한 경우도, 모바일웹이 유리한 경우도 있습니다.화면 변경이 잦거나, HTML 인터페이스로도 UI를 구성하고, 이용자 Action을 처리할 수 있는 경우에는 모바일웹을 구성하는 것이 유리할테고,인터페이스가 복잡하고, 이용자 만족도가 높은 품격있는 서비스를 고려한다면, 앱을 선택하는 편이 유리할 것입니다.
 

모바일웹

화면구성

웹서버 (JSP/PHP/ASP)

/클라이언트

서버와의 통신

데이터+ HTML

데이터

서버와의 통신 FORMAT

HTML

XML / JSON

이벤트 처리

HTML Action

Phone Action

네트워크부하

높음

낮음

변경작업

용이함

용이하지 않음

서비스 재활용

전체

데이터

이용자가 느끼는 완성도

보통

높음

<모바일웹 .vs 앱 비교정리>

[펌] http://a.tk.co.kr/635


반응형

+ Recent posts