like a Java Label

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nospamm@yahoo.com

    like a Java Label

    How I can achieve in javascript the behavior that I can get from a Java Label?

    I want to have a TEXT input which is initially preceded by the word "grams";
    but depending upon user input from a radio button, it should later be
    programmaticall y changed to say "ounces".

    grams<INPUT type=TEXT NAME="whatver" VALUE="0"></INPUT>

    ^^^^^^
    I want javascript to be able to change the above string 'grams', or else do
    something so that it looks as if it were changed. Can I change it directly, or
    should I use a LAYER <div> or what? Thanks.
  • mscir

    #2
    Re: like a Java Label

    nospamm@yahoo.c om wrote:
    [color=blue]
    > How I can achieve in javascript the behavior that I can get from a Java Label?
    >
    > I want to have a TEXT input which is initially preceded by the word "grams";
    > but depending upon user input from a radio button, it should later be
    > programmaticall y changed to say "ounces".
    >
    > grams<INPUT type=TEXT NAME="whatver" VALUE="0"></INPUT>
    >
    > ^^^^^^
    > I want javascript to be able to change the above string 'grams', or else do
    > something so that it looks as if it were changed. Can I change it directly, or
    > should I use a LAYER <div> or what? Thanks.[/color]

    Maybe something like this:

    function ToggleTextBoxDi splay(newText) {
    document.getEle mentById('div1' ).innerHTML=new Text;
    }
    </script>

    <b>Select Units (no form)</b><br><br>
    <input type="radio" name="graph_by"
    onclick="Toggle TextBoxDisplay( 'ounces')">Ounc es<br>
    <input type="radio" name="graph_by"
    onclick="Toggle TextBoxDisplay( 'grams')">Grams <br><br>

    <div id="div1" name="div1" style="position : absolute; width: 72px;
    height: 19px; left: 30px; top: 100px;">&nbsp;</div>
    <div id="div2" name="div2" style="position : absolute; width: 72px;
    height: 19px; left: 102px; top: 100px;">
    <input type="text" name="text1" id="text1" value="units" size=8 readonly>
    <div>
    </body>

    Comment

    Working...