what about using google ajax toolkit for extension's forms?
Daniele

On Fri, Oct 2, 2009 at 9:21 PM, Akira <ak...@yayakoshi.net> wrote:

>
> Okay, I will throw a sample in. This demonstrates the Javascript
> (would be even shorter if we use prototype.js or jQuery) and HTML
> inputs; we need to add CSS.
>
> This page would be opened at chrome-extension://<extension_id>/
> <filename>. E.g. my URL is temporarily "chrome-extension://
> mldfaejlnokodkpmfgjgggjgomacnffk/options.html". (<filename> is the
> path relative to your extensions top directory, as you would imagine.)
>
> For now open it by typing in the URL manually. If you just loaded it
> as an unpacked extension your id is aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
> etc. so type in chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/
> options.html or likewise.
>
> Note: values in localStorage will be obliterated if you load your
> unpacked extension, close chrome, then load it again. Either pack as a
> *.crx and install, or only use "Reload" in the extensions window
> without closing, when testing to prove that the values are stored
> inbetween sessions.
>
> *** options.html ***
> <html>
> <head>
>        <script type="text/javascript">
>        function initControls() {
>                document.getElementById("anonymize_inp").checked =
> localStorage.getItem("anonymize") == "true";
>                document.getElementById("user_nickname_inp").value =
> localStorage.getItem("user_nickname");
>
>                document.getElementById("anonymize_inp").onchange =
> function(event)
> {
>                        localStorage.setItem("anonymize", this.checked);
>                };
>                document.getElementById("user_nickname_inp").onkeyup =
> function
> (event) {
>                        localStorage.setItem("user_nickname", this.value);
>                };
>        }
>        </script>
>        <link rel="stylesheet" type="text/css" media="all"
> href="user_guides.css" />
> </head>
> <body onload="initControls();">
>
>        <h2>MyExtension options</h2>
>
>        <div>
>                <label for="user_nickname_inp">Your nickname:</label><br/>
>                <input id="user_nickname_inp"/>
>        </div>
>        <br/>
>        <div><label>Hide your nickname? <input type="checkbox"
> id="anonymize_inp"/></label><br/></div>
> </body>
> </html>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensions@googlegroups.com
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to