Re: [xul-interop] XUL Grand Coding Challenge 2004 - xmind - Counter Sample II
Charles Goodwin <[email protected]> Sat, 24 Sep 2005 14:56:11 +0100
| Newsgroups | gmane.comp.lang.xul.general |
|---|---|
| Message-ID | <[email protected]> |
Why use 1 function with unecessary logic when 3 simple functions would do?
i.e. Javascript:inc(), Javascript:dec(), Javascript:clear()
function inc() { document.getElementById("entry1").value++; }
function dec() { document.getElementById("entry1").value--; }
function clear() { document.getElementById("entry1").value=3D0; }
Much nicer!
- C
On 9/24/05, thomas favennec <[email protected]> wrote:
> ex: Counter for XUL challenge 2004
>
> <xmind title=3D"Xmind counter (V2) - XUL challenge 2004">
> <frame title=3D"Counter">
> <vbox>
> <hbox>
> <label>Count:</label>
> <entry name=3D"entry1" width=3D"200">0</entry>
> </hbox>
> <hbox>
> <button onclick=3D"Javascript:act(1)">Dec (-)</button>
> <button onclick=3D"Javascript:act(2)">Clear</button>
> <button onclick=3D"Javascript:act(3)">Inc (+)</button>
> </hbox>
> </vbox>
> </frame>
> <script>
> <![CDATA[
> function act(n) {
> a=3Ddocument.getElementById("entry1");
> if(n=3D=3D1) a.value--;
> if(n=3D=3D2) a.value=3D0;
> if(n=3D=3D3) a.value++; }
> ]]>
> </script>
> </xmind>
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
XUL News Wire - http://xulnews.com
XUL Job Postings - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org