473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Changing label

Hello

I was wondering if anyone could tell me how i can change a label
dynamically with each click on the label??

Thanks

Charly

Jul 14 '06 #1
4 3951
I dont know.. but

...Well you gotta start breaking it down right?

So.. do you have any code?

I guess we need a label.

<label id='clickMe' onClick='callFunction();'>

<function clickMe() {
// code goes here
}

Does that get you started?

Charlotte wrote:
Hello

I was wondering if anyone could tell me how i can change a label
dynamically with each click on the label??

Thanks

Charly
Jul 14 '06 #2
Very simply:

<html>
<head>
<script language = 'javascript'>

function changeLabelText(controlID)
{
var thisLabel = document.getElementById(controlID);
thisLabel.innerHTML = "Some Other Text";

}

</script>
</head>
<body>
<form>
<label for="radio1" id="radioLabel"
onclick="changeLabelText(this.id)">Some Text</label>
<input id="radio1" type="radio" />
</form>
</body>
</html>


Charlotte wrote:
Hello

I was wondering if anyone could tell me how i can change a label
dynamically with each click on the label??

Thanks

Charly
Jul 14 '06 #3
Beautiful!!

Thank you. I hope to get that fast soon. :)

Sevinfooter wrote:
Very simply:

<html>
<head>
<script language = 'javascript'>

function changeLabelText(controlID)
{
var thisLabel = document.getElementById(controlID);
thisLabel.innerHTML = "Some Other Text";

}

</script>
</head>
<body>
<form>
<label for="radio1" id="radioLabel"
onclick="changeLabelText(this.id)">Some Text</label>
<input id="radio1" type="radio" />
</form>
</body>
</html>


Charlotte wrote:
Hello

I was wondering if anyone could tell me how i can change a label
dynamically with each click on the label??

Thanks

Charly
Jul 14 '06 #4
Sevinfooter wrote:
<snip>
function changeLabelText(controlID)
{
var thisLabel = document.getElementById(controlID);
<snip>
<label for="radio1" id="radioLabel"
onclick="changeLabelText(this.id)">Some Text</label>
What is the rational of passing - this.id - and then using the ID
string passed with the - document.getElementById - method to look up a
reference to the LABEL element? Given that IDs must be unique within a
document and the - id - property of an element reflects its ID
attribute the element returned from document.getElemetnById must be the
same element as the - this - in - this.id -, so you may as well just
pass - this - and have the element reference in the function directly.
<input id="radio1" type="radio" />
<snip ^

And why the pseudo XHTML mark-up in a document that could only be HTML?

Richard.

Jul 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pavan Arise | last post by:
Hi all.. This may seem simple..but I am stuck here! I have a frame in which I have a label. I was trying to change the caption of that label via code (I mean at runtime & not design time). But...
2
by: Regnab | last post by:
I've searched through the posting and found what should be the solution to changing the value of a label.... Private Sub Report_Open(Cancel As Integer) Me.lblTest.Caption = "I love Access" End...
7
by: Ed West | last post by:
Hello, I have a simple form with some input boxes. After validation if one fails, then I would like to at the top of the page say something like "The following fields in red are required" and...
3
by: Pavan | last post by:
Hi All, I am having a wierd problem while displaying my panel. My code is something like this <table> <tr> <td width=100>label</td> <td width=100>label</td> <td width=100>label</td> <td...
6
by: AMP | last post by:
Hello, I have an mdi program with a child form ("A") and another child ("B"). I want to change the text of a label on A by changing an item from a combobox on B. I can code the...
8
by: flyingisfun1217 | last post by:
Hey, Sorry to bother everybody again, but this group seems to have quite a few knowledgeable people perusing it. Here's my most recent problem: For a small project I am doing, I need to...
5
kestrel
by: kestrel | last post by:
i have this <pre> I) stuff <label> stuff <input type="checkbox" name="1" /></label> <label> stuff <input type="checkbox" name="2" /></label> II) stuff <label> stuff...
6
by: andrew.ames | last post by:
Hi I have a pretty basic windows application created in Visual Studio 2005 and VB.NET. I set my Form's font to Arial 8.25pt, so when i added a label and a button they automatically have a...
7
by: emlimeng | last post by:
Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form". I hope I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.