Showing posts with label HTML. Show all posts
Showing posts with label HTML. 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));
}

Thursday, November 10, 2011

How to Build a Chrome Extension

I saw this article on lifehacker, thought it pretty cool: How to Build a Chrome Extension

Thursday, April 1, 2010

Gridview nowrap

What do you do when you have
AllowPaging="False" AllowSorting="False" AutoGenerateColumns="True" Width="800px" ShowHeader="true"

And it wraps all your data?

you add:

OnRowDataBound="GridView_RowDataBound"

and then:

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
}
}

Thursday, July 31, 2008

Parse html table cells

I wanted to parse a html table and color the TD - s (background).
All of them.
I have a column that has links in it. My basic Idea was to change the background color of the TD when you click the link inside that. That's easy, but without some global (js?) variable, you don't know what was previously clicked, and you might want to turn that "off" :)
Anyways: this is how I did it:





function ParseTableAndColorTheBackground(objTbl, WhatColorShouldItBe)
{
var intNrOfTrs = objTbl.tBodies[0].rows.length;
for (var i=0; i < intNrOfTrs; i++)
{
objTbl.tBodies[0].rows[i].cells[1].style.backgroundColor = WhatColorShouldItBe;
}
}




you have a better way to do this?

comment me pls
;)