CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 onChange to change label value

Print topic Send  topic

Author Message
elviswang

Posts: 3
Posted: 11/19/2004, 12:06 AM

Dear all,

I have a table in database like:
sn name
-------------------------------
1 elvis
2 dennis

also, there is 'ListBox1' can select 'sn' and ' Label1' want to show corresponding 'name'.

how to use ListBox1 onChange event to change the value of Label1.


View profile  Send private message
zeuch


Posts: 25
Posted: 11/19/2004, 3:16 AM

Hi elvis,
you can use this code:
<html>  
<head>  
  <title>Set Label Function</title>  
  <script type="text/javascript">  
    function setLabel(obj) {  
      document.getElementById("label").innerHTML = obj.value;  
      return false;  
    }  
  </script>  
</head>  
<body>  
  
<form>  
  <select width="10" onchange="return setLabel(this);">  
    <option></option>  
    <option value="this is the option 1">1</option>  
    <option value="this is the option 2">2</option>  
  </select>  
  <span id="label"></span>  
</form>  
  
</body>  
</html>  

To use this code you must to have the name in value attribute of the option. Javascript don't to access the server data base ;-)

Regards
_________________
Matheus Zeuch
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.