How to made a DIV element OnClick event call server side function

M

moondaddy

I'm using html labels (div elements) instead of server controls such as an
asp link button because I want to control the mouseover, mouseout, mousedown
and mouseup events to control its appearance accordingly. So the way I see
it I have 2 ways to go:
1) Use a div element so I can control its appearance with jscript and then
in its onclick event call some jscript that starts a postback and calls a
server side function
or
2) Use a asp link button and some how use client side jscript to control its
appearance.

Which one of these would be best and how would I make it work, or is there a
3rd/better option?
 
W

www.eztree-msdn.com \( Laurent Jordi \)

Hi,

Very simple...

You prepare as many CSS Class as apparences you need.
You create a "listener" for each event you want to treat.

document.onmouseover = MakeBright; //Execute MakeBright Each time a
mouseOver occurs on the document.

When the event fired, you use
function MakeBright(){
window.event.srcElement.class="BrightClass";
}

Regards

LJ

www.eztree-msdn.com
 
M

moondaddy

Thanks. Based one your sample code I came up with this with works good.




function document.onmouseover()
{
var eSrc = window.event.srcElement;
if (eSrc.id == "lbEditBillAddress" || eSrc.id == "lbEditShipAddress" ||
eSrc.id == "lbEditShoppingCart" )
{
lblMseOver(eSrc);
}
}


function lblMseOver(obj)
{
obj.className="clsBillingSummaryEdtButtonOver"
}






--
(e-mail address removed)
www.eztree-msdn.com ( Laurent Jordi ) said:
Hi,

Very simple...

You prepare as many CSS Class as apparences you need.
You create a "listener" for each event you want to treat.

document.onmouseover = MakeBright; //Execute MakeBright Each time a
mouseOver occurs on the document.

When the event fired, you use
function MakeBright(){
window.event.srcElement.class="BrightClass";
}

Regards

LJ

www.eztree-msdn.com









moondaddy said:
I'm using html labels (div elements) instead of server controls such as an
asp link button because I want to control the mouseover, mouseout, mousedown
and mouseup events to control its appearance accordingly. So the way I see
it I have 2 ways to go:
1) Use a div element so I can control its appearance with jscript and then
in its onclick event call some jscript that starts a postback and calls a
server side function
or
2) Use a asp link button and some how use client side jscript to control its
appearance.

Which one of these would be best and how would I make it work, or is
there
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top