File: manager_example.html

Recommend this page to a friend!
  Classes of Arturs Sosins   FCookie   manager_example.html   Download  
File: manager_example.html
Role: Example script
Content type: text/plain
Description: Simple SharedObject Manager
Class: FCookie
Store and retrieve values in Flash cookies
Author: By
Last change:
Date: 13 years ago
Size: 3,123 bytes


Class file image Download
<!-- /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, * Fee free to distribute and modify code, but keep reference to its creator * * This class can be used to manipulate SharedObjects (aka Flash cookies) * using swf file provided in package with different domain and namespace sstings. * This class can set values from javascript, get saved values from * SharedObjects (preserving data types) and delete SharedObjects. * * For more information, examples and online documentation visit: * **************************************************************/ --> <html> <head> </head> <body> <div id='loading'>Loading...</div> <div id='manage' style='display: none;'> <fieldset> <legend>Create new:</legend> <p>Key: <input type='text' id='new_key'/> Value: <input type='text' id='new_val'/> <input type='button' value='Save' onclick='add();'/> </p> </fieldset> <fieldset> <legend>Manage existing:</legend> <p>Existing keys: <select id='exist_key' onchange='update();'> </select> Value(editable): <input type='text' id='exist_val'/> <input type='button' value='Save' onclick='save()'/> <input type='button' value='Delete' onclick='del()'/> </p> </fieldset> <fieldset> <legend>Delete all:</legend> <p> <input type='button' value='Delete all' onclick='del_all()'/> </p> </fieldset> </div> <script type="text/javascript" src="./fcookie.packed.js" ></script> <script type="text/javascript"> var fc = new fcookie({ debug: false, namespace: "example", onload: function() { if(fc.check()) { document.getElementById("loading").style.display = "none"; document.getElementById("manage").style.display = "block"; reset(); } else { document.getElementById("loading").value = "Can not create SharedObject, check your flash settings"; } } }); function reset() { var elem = document.getElementById("exist_key"); for(var i = elem.options.length-1; i>=0; i--) { elem.remove(i); } var arr = fc.get_all(); var opt = document.createElement("option"); opt.text = "---"; opt.value = ""; elem.options.add(opt); for(var i in arr) { var opt = document.createElement("option"); opt.text = i; opt.value = i; elem.options.add(opt); } document.getElementById("exist_val").value = ""; } function add(){ fc.set(document.getElementById("new_key").value, document.getElementById("new_val").value); reset(); } function update(){ var val = document.getElementById("exist_key").value; document.getElementById("exist_val").value = fc.get(val); } function save(){ var val = document.getElementById("exist_key").value; if(val != "") { fc.set(val, document.getElementById("exist_val").value); } reset(); } function del(){ fc.del(document.getElementById("exist_key").value); reset(); } function del_all(){ fc.del_all(); reset(); } </script> </body> </html>