473,396 Members | 1,871 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.

Forecolor Change

I have an image placed on an aspx page.

<img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to Display

How can I change the forecolor of the text 'My Text to display' in function
abc()?

Either in java or c#
Nov 19 '05 #1
4 3016
> <img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to
Display

How can I change the forecolor of the text 'My Text to display' in function abc()?

Either in java or c#


You could wrap the text in a wrapper SPAN and then change the color via the
CSS or Javascript.

Or you could hard-code the color in via a LABEL control or LITERAL control
and change it from the codebehind.

-Darrel
Nov 19 '05 #2
I tried a span. But no luck yet. Could you post a sample please?

I don't know how to do the label though.

"darrel" wrote:
<img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to

Display

How can I change the forecolor of the text 'My Text to display' in

function
abc()?

Either in java or c#


You could wrap the text in a wrapper SPAN and then change the color via the
CSS or Javascript.

Or you could hard-code the color in via a LABEL control or LITERAL control
and change it from the codebehind.

-Darrel

Nov 19 '05 #3
Hi,

Here is some help...

<asp:Label id="Label1" runat="server">My Text to display</asp:Label>
public void abc()
{
Label1.forecolor = yourcolor; //or "blue"
}

BUT, of course you can't call a c# method directly from onmouseover of
image. So, the span solution is your best bet. Same idea as above.

<script>

function abc()
{
var mycolor ="green";
elspano.style.color = mycolor;
}
</script>
</head>
<body>

<IMG id="xyz" src="yourimage.gif" onMouseover="abc()"><SPAN id="elspano">my
text to display</SPAN>

</body>

Take care,
Joel

"rkbnair" <rk*****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
I tried a span. But no luck yet. Could you post a sample please?

I don't know how to do the label though.

"darrel" wrote:
> <img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to

Display
>
> How can I change the forecolor of the text 'My Text to display' in

function
> abc()?
>
> Either in java or c#


You could wrap the text in a wrapper SPAN and then change the color via
the
CSS or Javascript.

Or you could hard-code the color in via a LABEL control or LITERAL
control
and change it from the codebehind.

-Darrel

Nov 19 '05 #4
Excellent. It works.

However, how can I change the backcolor? What is the syntax for changing the
background color?
elspano.style.color = mycolor;???

"Joel Palmer" wrote:
Hi,

Here is some help...

<asp:Label id="Label1" runat="server">My Text to display</asp:Label>
public void abc()
{
Label1.forecolor = yourcolor; //or "blue"
}

BUT, of course you can't call a c# method directly from onmouseover of
image. So, the span solution is your best bet. Same idea as above.

<script>

function abc()
{
var mycolor ="green";
elspano.style.color = mycolor;
}
</script>
</head>
<body>

<IMG id="xyz" src="yourimage.gif" onMouseover="abc()"><SPAN id="elspano">my
text to display</SPAN>

</body>

Take care,
Joel

"rkbnair" <rk*****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
I tried a span. But no luck yet. Could you post a sample please?

I don't know how to do the label though.

"darrel" wrote:
> <img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to
Display
>
> How can I change the forecolor of the text 'My Text to display' in
function
> abc()?
>
> Either in java or c#

You could wrap the text in a wrapper SPAN and then change the color via
the
CSS or Javascript.

Or you could hard-code the color in via a LABEL control or LITERAL
control
and change it from the codebehind.

-Darrel


Nov 19 '05 #5

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

Similar topics

0
by: Allcomp | last post by:
Hello, I would like to change the Forecolor of a comboItem (of a ImageCombo), but I can't make it. I can't see any forecolor in the method or properties. If I change the forecolor of the...
2
by: Jurgen Oerlemans | last post by:
Hello, I want to change to forecolor of a label. The label is named "lblDevice1" I create a variable called Var Dim Var Var = "lblDevice1" So the next step is: Var.ForeColor =...
5
by: Bernie Yaeger | last post by:
When you use xp styles Application.EnableVisualStyles() Application.DoEvents() and you change a control's flat style to 'system', you then are not able to set the control's forecolor,...
0
by: ck.kislay | last post by:
If ,I change the alpha value of forecolor of control like button in VS 2005 then the forecolor didnot show the variation ,forecolor still unchanged while changing the alpha value. I want to show...
2
by: Phillip Vong | last post by:
Newbie learning in VB.NET Stupid question. I have Label1.Text = "Hello World" How do I change the Forecolor in code? I know how to set it using VS but I want to change the Forecolor...
0
by: Wolfgrin | last post by:
Hi, I have set up a report In Access 2003 where there are 2 check boxes I refer to to change the color of the Date of that record. That part is working. I also need to Change the color of the...
7
by: moondaddy | last post by:
in asp.net 2.0, i have a link buttonand want to change the forecolor in a mouse over event. how can I do this? -- moondaddy@noemail.noemail
4
by: TD | last post by:
I am trying to change the forecolor of a field in a subform that is in datasheet view. I am using Access 2007. I have tried everything I can think of to do this but the text still appears in...
17
by: govolsbaby | last post by:
Is there a way to leave the button forecolor unchanged when it is disabled? I have multiple buttons on the form and depending on various user inputs, some will or will not be enabled but I'd...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.