Showing posts with label appear. Show all posts
Showing posts with label appear. Show all posts

Saturday, March 31, 2012

set absolute position on panel

How can the absolute position be set when a button is hit. I have a help
pannel that i want to appear next to the "?" button that is selected.
thanks
any ideas would be appreciated
kesset
obj.style.top = x;
obj.style.left = y;
to find the x and y of an object:
window.getYPos = function(obj){
var curtop = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curtop += obj.offsetTop;
if (typeof(obj.scrollTop) == 'number')
curtop -= obj.scrollTop;
obj = obj.offsetParent;
}
}
else if (document.layers)
curtop += obj.y;
return curtop;
}
window.getXPos = function(obj) {
var curleft = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (document.layers)
curleft += obj.x;
return curleft;
}
-- bruce (sqlwork.com)
"Kurt Schroeder" <KurtSchroeder@.discussions.microsoft.com> wrote in message
news:522009E3-7335-4B58-A4E9-28F9C49281E1@.microsoft.com...
> How can the absolute position be set when a button is hit. I have a help
> pannel that i want to appear next to the "?" button that is selected.
> thanks
> any ideas would be appreciated
> kes

set absolute position on panel

How can the absolute position be set when a button is hit. I have a help
pannel that i want to appear next to the "?" button that is selected.

thanks
any ideas would be appreciated
kesset
obj.style.top = x;
obj.style.left = y;

to find the x and y of an object:

window.getYPos = function(obj){
var curtop = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curtop += obj.offsetTop;
if (typeof(obj.scrollTop) == 'number')
curtop -= obj.scrollTop;
obj = obj.offsetParent;
}
}
else if (document.layers)
curtop += obj.y;
return curtop;
}
window.getXPos = function(obj) {
var curleft = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (document.layers)
curleft += obj.x;
return curleft;
}

-- bruce (sqlwork.com)

"Kurt Schroeder" <KurtSchroeder@.discussions.microsoft.com> wrote in message
news:522009E3-7335-4B58-A4E9-28F9C49281E1@.microsoft.com...
> How can the absolute position be set when a button is hit. I have a help
> pannel that i want to appear next to the "?" button that is selected.
> thanks
> any ideas would be appreciated
> kes

Thursday, March 22, 2012

Set Focus to TextBox

I would like to set the focus to a textbox when the page first openes. I have a couple of textboxes on the form and would like the cursor to appear in the first text box when the page opens.

This is the code that I am tring to work with


<td style="WIDTH: 81px; HEIGHT: 27px" align="left">Defect:</td
<td style="WIDTH: 141px; HEIGHT: 27px">
<asp:textbox id="Defect" Runat="server" Width="304px"></asp:textbox></td>

Can anyone help me set the focus to this textbox.

Thanks.Use this JavaScript:


function SetFocusToControl(id) {
document.getElementById(id).focus();
}

In you code, just use the following code:

protected TextBox Defect;

void Page_Load(object sender, EventArgs e) {
Page.RegisterStartUpScript("focusScript", String.Format("<script language=\"JavaScript\">SetFocusToControl('{0}');</script>", Defect.ClientID));
}