0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

USHI.BOXの中身

Last updated at Posted at 2015-10-31

USHI.COMはこの様な中身になっています。
まずUSHIBOXです。JavaScriptを使用しています。

(function (){

	// テキストフォームの element を取得
	var element_edit = document.getElementById("edit_00");

	var element;
	
	// 読み込みボタンの element を取得
	element = document.getElementById("button_00_load");
	// ボタンが押されたときに実行されるイベント
	element.onclick = function (){
		try{
			// "test_key" からデータを取り出す
			element_edit.value = localStorage.getItem("test_key");
		}catch(e){
			// エラーを出力
			element_edit.value = e + "\n" + element_edit.value;
		}
	};


	// 保存ボタンの element を取得
	element = document.getElementById("button_00_save");
	// ボタンが押されたときに実行されるイベント
	element.onclick = function (){
		try{
			// "test_key" にデータを保存する
			localStorage.setItem("test_key",element_edit.value);
		}catch(e){
			// エラーを出力
			element_edit.value = e + "\n" + element_edit.value;
		}
	};


	// 削除ボタンの element を取得
	element = document.getElementById("button_00_del");
	// ボタンが押されたときに実行されるイベント
	element.onclick = function (){
		try{
			// "test_key" のデータを削除する
			localStorage.removeItem("test_key");
		}catch(e){
			// エラーを出力
			element_edit.value = e + "\n" + element_edit.value;
		}
	};
})();

こうでしょう。
参考したURLはhttp://hakuhin.jp/js/storage.html です。
文字などは自分で作って下さい。

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?