By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,661 Members | 1,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,661 IT Pros & Developers. It's quick & easy.

Changing and image to a text field.

P: n/a
JB
I have a set of links that are currently images that when the person rolls
over them, they change color. Essentially the image is a box where the
background is brown and the text is blue. When the person rolls over it,
they want it blue background with brown text. As I said we currently do
images but that is annoying.

Is there an easy way ( or at least relatively easy ) way to do this just
using text and javascript to change the colors?

TIA - Jeff.
Feb 27 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Howdy,

Yes, it's quite simple. Here is a rough example that should give you an idea
where to go:

<style type="text/css">
..MouseOut
{
border: solid 1px black;
background-color: orange;
color: blue;
}
..MouseOver
{
border: solid 1px red;
background-color: brown;
color: white;
}
</style>
<asp:HyperLink runat="server" ID="myLink" CssClass="MouseOut"
onmouseover="ChangeApperance(this, true)"
onmouseout="ChangeApperance(this, false)" Text="Click me!" NavigateUrl="#" />

<script type="text/javascript">

function ChangeApperance(anchor, isMouseOver)
{
if (anchor)
{
anchor.className = isMouseOver ? 'MouseOver' : 'MouseOut';
}
}

</script>

Please note your requirement is a perfect subject to build a web server
control inheriting from hyperlink.

--
Milosz
"JB" wrote:
I have a set of links that are currently images that when the person rolls
over them, they change color. Essentially the image is a box where the
background is brown and the text is blue. When the person rolls over it,
they want it blue background with brown text. As I said we currently do
images but that is annoying.

Is there an easy way ( or at least relatively easy ) way to do this just
using text and javascript to change the colors?

TIA - Jeff.
Feb 27 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.