HighDots Forums  

like a Java Label

Javascript JavaScript language (comp.lang.javascript)


Discuss like a Java Label in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nospamm@yahoo.com
 
Posts: n/a

Default like a Java Label - 05-01-2004 , 02:45 PM






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
programmatically 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.

Reply With Quote
  #2  
Old   
mscir
 
Posts: n/a

Default Re: like a Java Label - 05-01-2004 , 05:47 PM






nospamm (AT) yahoo (DOT) com wrote:

Quote:
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
programmatically 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.
Maybe something like this:

function ToggleTextBoxDisplay(newText) {
document.getElementById('div1').innerHTML=newText;
}
</script>

<b>Select Units (no form)</b><br><br>
<input type="radio" name="graph_by"
onclick="ToggleTextBoxDisplay('ounces')">Ounces<br >
<input type="radio" name="graph_by"
onclick="ToggleTextBoxDisplay('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>



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.