Forecolor Change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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#
 
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
 
I tried a span. But no luck yet. Could you post a sample please?

I don't know how to do the label though.
 
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
 
Excellent. It works.

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