Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change form labels dynamically 1

Status
Not open for further replies.

delorfra

Programmer
Mar 8, 2001
79
FR
Hi,
I have a form where labels are by default in one language. I want that when the user clicks on a specific flag image, the labels (fields names) are dynamically displayed on the fly in another language (i.e without having to fetch the whole page again from the server).
I have stored the labels in different languages (EN, FR, DE ..) in a database .
My problem is that I don't know how to do that since labels are just simple html text and not form fields which names one can call from a Javascript script to change their value.

Thanks for your help
blygman@hotmail.com

François
 
Hi
Put the labels into a span and change the value using innerHTML

<span id=&quot;label1&quot;>Label Text</span><input type=&quot;text&quot;>

<script>
document.getElementById(&quot;label1&quot;).innerHTML = &quot;Other Text&quot;;
</script> Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Thanks a lot Helltel !
blygman@hotmail.com

François
 
No probs. Thanks for the star! [wiggle] Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top