--- joe ertaba <[EMAIL PROTECTED]> wrote:
> It works when I don't use for example a button to update text of text box
>
> what if I have several buttons that also update that text box too
>
> On Thu, Feb 14, 2008 at 11:17 PM, Eric H. Jung <[EMAIL PROTECTED]> wrote:
>
> > As Neil suggests, you could do:
> >
> > <textbox id="tb" onkeypress="styleInput(this);"/>
> >
> > <script>
> > function styleInput(tb) {
> > tb.setStyle(tb.value == "special input" ?
> > "font-weight: bold;" : "font-weight: normal; font-style: italic;");
> > // you could also use tb.setStyle() or tb.className = myClass
> >
If youhave several buttons that update text in the same <textbox/> then have
the buttons call the
same styleInput() method. Obvisouly, the buttons can't use |this| as the
argument to styleInput().
They need to use document.getElementById("tb") as the argument. By the way, I
didn't mean to write
tb.setStyle(). I meant to write tb.setAttribute("style", ...). You could also
use
tb.style['font-weight'] or tb.style.fontWeight (note: untested).
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners