views:

25

answers:

2

I am using the <a> element to increase the font size in my webpage.

<a href="javascript:increaseFontSize();">+</a>

The problem with it is that i cannot set a background image.

So what component should i choose from the VS2008 toolbox that has OnClientClick property and does not post-back?

For examaple, i set the OnClientClick property in a ImageButton, but the postback is executed after the ClientSide click

A: 

Why would you want to use server controls? Can't you give a class to the anchor and define a background image:

<a href="javascript:increaseFontSize();" class="plus">+</a>

And in css:

.plus {
    background-image:url('plus.gif');
}
Darin Dimitrov
I did not want to use a server side control. I am just a newbie!
Chocol8
+1  A: 

The element has to be a block element to be able to have a background image. You shouldn't use a link anyway, as it's not really a link to anywhere.

It doesn't have to be a server control out of the toolbox, server controls tend to have extra code added to them to do postbacks. You can simply use a div element and style it to look any way you want. For example:

HTML:

<div class="increase" onclick="increaseFontSize();">+</div>

CSS:

.increase { width: 20px; height: 20px; background: url(button.gif); color: #ccc; }
.increase:hover { color: #fff; }
Guffa