Showing posts with label client side. Show all posts
Showing posts with label client side. Show all posts

Thursday, October 12, 2017

Find position of object in the screen

Tested it, it works pretty nice in FF, Chrome, IE, Safari too.
function resetPosition(object, args) {
/* find the textbox object */
var tb = object._element;
/* measure textbox height */
var tbheight = tb.offsetHeight;
/* find textbox in the page */
var rect = tb.getBoundingClientRect();
var divleft = Math.floor(rect.left);
var divtop = Math.floor(rect.top + tbheight);
/* find the auto complete extender div in the page */
var ex = object._completionListElement;
/* move the ace to the right position */
if (ex)
$common.setLocation(ex, new Sys.UI.Point(divleft, divtop));
}

Monday, September 1, 2008

Calling a server side from client's Javascript

Did you ever need something like calling a server side thing from client's? Javascript ... ?

I think this is an easy way of doing that:





Response.Write ( " < script language="javascript"> function SetPmoR_Id() { document.all('" + lkbPmoRepAdd.ClientID + "').click(); } < / script>")

//or:

ClientScript.RegisterClientScriptBlock(this.GetType(), "somethn", " < script type='text/javascript'> function whatdoyouwannacalit() { try {document.all('" + yourlinkbutton.ClientID + "').click();} catch(e){} } < / script>");






what do you think?

you think there's an easier way? comment!