inputbox

Discussion in 'Javascript' started by Intos, Sep 23, 2008.

  1. Intos

    Intos Guest

    Hi.

    How to change the text of inputbox if i have already set the style for
    something else?

    In other words:
    <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    maxlength="60" border="0" />

    I can not add two styles on the same inputbox so i guess that javascript is
    the only solution?
    If so, then how ?


    Regards!
    Intos, Sep 23, 2008
    #1
    1. Advertising

  2. Intos

    GArlington Guest

    On Sep 23, 11:27 am, "Intos" <> wrote:
    > Hi.
    >
    > How to change the text of inputbox if i have already set the style for
    > something else?
    >
    > In other words:
    > <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    > maxlength="60"  border="0" />
    >
    > I can not add two styles on the same inputbox so i guess that javascript is
    > the only solution?
    > If so, then how ?
    >
    > Regards!


    <input ... style="border:hidden; color:blind; some:eek:ther;" ... />
    Is that what you wanted?
    GArlington, Sep 23, 2008
    #2
    1. Advertising

  3. Intos

    Erwin Moller Guest

    Intos schreef:
    > Hi.
    >
    > How to change the text of inputbox if i have already set the style for
    > something else?
    >
    > In other words:
    > <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    > maxlength="60" border="0" />
    >
    > I can not add two styles on the same inputbox so i guess that javascript is
    > the only solution?
    > If so, then how ?


    Hi,

    In your case:
    document.getElementById("fItem").style.border='1px solid #99999;';

    Of course you can assign anything valid to the style.

    Regards,
    Erwin Moller


    >
    >
    > Regards!
    >
    >



    --
    ============================
    Erwin Moller
    Now dropping all postings from googlegroups.
    Why? http://improve-usenet.org/
    ============================
    Erwin Moller, Sep 23, 2008
    #3
  4. Intos

    Intos Guest

    "Erwin Moller"
    <> wrote in
    message news:48d8d477$0$186$4all.nl...
    >
    > Intos schreef:
    >> Hi.
    >>
    >> How to change the text of inputbox if i have already set the style for
    >> something else?
    >>
    >> In other words:
    >> <input name="fItem" type="text" id="fItem" style="border:hidden"
    >> size="80" maxlength="60" border="0" />
    >>
    >> I can not add two styles on the same inputbox so i guess that javascript
    >> is the only solution?
    >> If so, then how ?

    >
    > Hi,
    >
    > In your case:
    > document.getElementById("fItem").style.border='1px solid #99999;';
    >
    > Of course you can assign anything valid to the style.
    >
    > Regards,
    > Erwin Moller
    >
    >
    >>
    >>
    >> Regards!

    >
    >
    > --
    > ============================
    > Erwin Moller
    > Now dropping all postings from googlegroups.
    > Why? http://improve-usenet.org/
    > ============================


    ----------------
    Thank you guys, that's it. Just one small thing. How to align the text of
    the input box in the center of the inputbox ?
    Intos, Sep 23, 2008
    #4
  5. GArlington wrote:
    > On Sep 23, 11:27 am, "Intos" <> wrote:
    >> How to change the text of inputbox if i have already set the style for
    >> something else?
    >>
    >> In other words:
    >> <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    >> maxlength="60" border="0" />
    >>
    >> I can not add two styles on the same inputbox so i guess that javascript is
    >> the only solution?
    >> If so, then how ?

    >
    > <input ... style="border:hidden; color:blind; some:eek:ther;" ... />
    > Is that what you wanted?


    Unlikely, since it is not Valid HTML or CSS in the first place.

    <http://validator.w3.org/>
    <http://jigsaw.w3.org/css-validator/>


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Sep 23, 2008
    #5
  6. Intos

    SAM Guest

    Intos a écrit :
    > Hi.
    >
    > How to change the text of inputbox if i have already set the style for
    > something else?


    document.forms[0].elements['myInput'].value = 'some text';

    > In other words:
    > <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    > maxlength="60" border="0" />
    >
    > I can not add two styles on the same inputbox so i guess that javascript is
    > the only solution?


    certainly not

    > If so, then how ?


    Perhaps would you have to learn a bit about CSS ?

    In JS :

    var d = document.forms[0].elements['myInput'].style:
    d.color = 'blue';
    d.fontWeight = 'bold';
    d.textDecoration = 'underline';
    d.textAlign = 'center';
    etc ... etc ...


    try :

    <html>
    <style type="text/css">
    ..red { color: red }
    ..blu { color: blue }
    ..bold { font-weeight: bold; }
    input { color: inherit; border: 3px solid green }
    </style>

    <form action="#" onsubmit="return false">
    <p class="red" id="one">
    <input value="test 1">
    <input value="test 2 (blue n' bold by class)" class="blu bold">
    <input value="test 1">
    </p>
    <p class="blu" id="two">
    <input value="test 4">
    <input value="test 5 (red n' bold by style)"
    style="color:red;font-weight:bold"">
    <input value="test 6">
    </p>
    <p><button onclick="var d =document.getElementById('one');
    d.className = d.className=='red'? 'blu' : 'red';">toggle 1</button>
    <button onclick="var d =document.getElementById('two');
    d.className = d.className=='red'? 'blu' : 'red';">toggle 2</button>
    </form>
    </html>

    --
    sm
    SAM, Sep 23, 2008
    #6
  7. Intos

    Tom Cole Guest

    On Sep 23, 8:41 am, "Intos" <> wrote:
    > "Erwin Moller"
    > <> wrote in
    > messagenews:48d8d477$0$186$4all.nl...
    >
    >
    >
    >
    >
    >
    >
    > > Intos schreef:
    > >> Hi.

    >
    > >> How to change the text of inputbox if i have already set the style for
    > >> something else?

    >
    > >> In other words:
    > >> <input name="fItem" type="text" id="fItem" style="border:hidden"
    > >> size="80" maxlength="60"  border="0" />

    >
    > >> I can not add two styles on the same inputbox so i guess that javascript
    > >> is the only solution?
    > >> If so, then how ?

    >
    > > Hi,

    >
    > > In your case:
    > > document.getElementById("fItem").style.border='1px solid #99999;';

    >
    > > Of course you can assign anything valid to the style.

    >
    > > Regards,
    > > Erwin Moller

    >
    > >> Regards!

    >
    > > --
    > > ============================
    > > Erwin Moller
    > > Now dropping all postings from googlegroups.
    > > Why?http://improve-usenet.org/
    > > ============================

    >
    > ----------------
    > Thank you guys, that's it. Just one small thing. How to align  the textof
    > the input box in the center of the inputbox ?- Hide quoted text -
    >
    > - Show quoted text -


    document.getElementById("fItem").style.textAlign="center"
    Tom Cole, Sep 23, 2008
    #7
  8. Intos

    Hal Rosser Guest

    "Intos" <> wrote in message
    news:gbagas$bh5$...
    > Hi.
    >
    > How to change the text of inputbox if i have already set the style for
    > something else?
    >
    > In other words:
    > <input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
    > maxlength="60" border="0" />
    >
    > I can not add two styles on the same inputbox so i guess that javascript
    > is the only solution?
    > If so, then how ?
    >


    Naw - just use the value attribute
    <input name="fItem" type="text" id="fItem"
    style="border:hidden" size="80"
    maxlength="60" border="0"
    value="Hello world" />

    And if you need more styles, separate them with semicolons.

    ..
    Hal Rosser, Sep 24, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. André Almeida Maldonado

    InputBox

    André Almeida Maldonado, May 5, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    5,371
    Kevin Spencer
    May 5, 2004
  2. Reza Alirezaei

    javascript inputbox and datagrid

    Reza Alirezaei, May 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    945
    Natty Gur
    May 14, 2004
  3. Jase

    Stop InputBox prompt loop?

    Jase, Feb 4, 2004, in forum: Java
    Replies:
    1
    Views:
    451
    Thomas Kellerer
    Feb 4, 2004
  4. Replies:
    1
    Views:
    369
    Chris Smith
    Apr 19, 2006
  5. Anthony_Barker

    Inputbox with win32api?

    Anthony_Barker, Jun 27, 2003, in forum: Python
    Replies:
    1
    Views:
    1,077
    John J. Lee
    Jun 27, 2003
Loading...

Share This Page