
/**//******************************************************************
** Copyright (c) 2001-2006
** FileName: UIHelper.cs
** Creator:
** CreateDate:
** Changer:
** LastChangeDate:
** Description: Class used for UI unification.
* It will make easier to set the UI.
* More info please read the remark of functions.
** VersionInfo:
******************************************************************/
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Text;
using System.Collections;




/**//// <summary>
/// Summary description for UIHelper
/// </summary>
public class UIHelper


{

Property Get BaseUrl#region Property Get BaseUrl

/**//// <summary>
/// The base url of application
/// </summary>
public static string BaseUrl

{
get

{
string strBaseUrl = "";
strBaseUrl += "http://" + HttpContext.Current.Request.Url.Host;
if (HttpContext.Current.Request.Url.Port.ToString() != "80")

{
strBaseUrl += ":" + HttpContext.Current.Request.Url.Port;
}
strBaseUrl += HttpContext.Current.Request.ApplicationPath;

return strBaseUrl + "/";
}
}
#endregion


Static Alert()#region Static Alert()
public static void Alert(System.Web.UI.Page pageCurrent, string strMsg)

{

//Replace \n
strMsg = strMsg.Replace("\n", "\\n");
//Replace \r
strMsg = strMsg.Replace("\r", "\\r");
//Replace "
strMsg = strMsg.Replace("\"", "\\\"");
//Replace '
strMsg = strMsg.Replace("\'", "\\\'");

pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
System.Guid.NewGuid().ToString(),
"<script>window.alert('" + strMsg + "')</script>"
);
}

#endregion


Static Alert()#region Static Alert()
//public static void Alert(UpdatePanel upUsedUpdatePanel, string strMsg)
//{

// //Replace \n
// strMsg = strMsg.Replace("\n", "\\n");
// //Replace \r
// strMsg = strMsg.Replace("\r", "\\r");
// //Replace "
// strMsg = strMsg.Replace("\"", "\\\"");
// //Replace '
// strMsg = strMsg.Replace("\'", "\\\'");
// ScriptManager.RegisterStartupScript(upUsedUpdatePanel, upUsedUpdatePanel.GetType(), Guid.NewGuid().ToString(), "<script>window.alert('" + strMsg + "')</script>", false);
//}

#endregion


Static Redirect()#region Static Redirect()

/**//// <summary>
/// Add the javascript method to redirect page on client
/// Created :
/// Modified:
/// </summary>
/// <param name="pageCurrent"></param>
/// <param name="strPage"></param>
public static void Redirect(System.Web.UI.Page pageCurrent, string strPage)

{
if (!pageCurrent.IsCallback)

{
pageCurrent.Response.Redirect(strPage);
}
else

{

}
//pageCurrent.RegisterStartupScript(
// System.Guid.NewGuid().ToString(),
// "<script>window.location.href='" + strPage + "'</script>"
// );
}

/**//// <summary>
/// javascript redirect to another page
/// </summary>
/// <param name="pageCurrent"></param>
/// <param name="strPage"></param>
public static void JavescriptRedirect(System.Web.UI.Page pageCurrent, string strPage)

{
pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
System.Guid.NewGuid().ToString(),
"<script>window.location.href='" + strPage + "'</script>"
);
}
#endregion


Static AddConfirm#region Static AddConfirm

/**//// <summary>
/// Add the confirm message to button
///
///
/// </summary>
/// <param name="button">The control, must be a button</param>
/// <param name="strMsg">The popup message</param>
public static void AddConfirm(System.Web.UI.WebControls.Button button, string strMsg)

{
strMsg = strMsg.Replace("\n", "\\n");
strMsg = strMsg.Replace("\r", "\\r");
strMsg = strMsg.Replace("\"", "\\\"");
strMsg = strMsg.Replace("\'", "\\\'");
button.Attributes.Add("onClick", "return confirm('" + strMsg + "')");
}


/**//// <summary>
/// Add the confirm message to button
///
///
/// </summary>
/// <param name="button">The control, must be a button</param>
/// <param name="strMsg">The popup message</param>
public static void AddConfirm(System.Web.UI.WebControls.ImageButton button, string strMsg)

{
strMsg = strMsg.Replace("\n", "\\n");
strMsg = strMsg.Replace("\r", "\\r");
strMsg = strMsg.Replace("\"", "\\\"");
strMsg = strMsg.Replace("\'", "\\\'");
button.Attributes.Add("onClick", "return confirm('" + strMsg + "')");
}


/**//// <summary>
/// Add the confirm message to one column of gridview
/// </summary>
/// <param name="grid">The control, must be a GridView</param>
/// <param name="intColIndex">The column index. It's usually the column which has the "delete" button.</param>
/// <param name="strMsg">The popup message</param>
public void AddConfirm(System.Web.UI.WebControls.GridView grid, int intColIndex, string strMsg)

{
strMsg = strMsg.Replace("\n", "\\n");
strMsg = strMsg.Replace("\r", "\\r");
strMsg = strMsg.Replace("\"", "\\\"");
strMsg = strMsg.Replace("\'", "\\\'");
for (int i = 0; i < grid.Rows.Count; i++)

{
grid.Rows[i].Cells[intColIndex].Attributes.Add("onclick", "return confirm('" + strMsg + "')");
}
}
#endregion


Static AddShowDialog#region Static AddShowDialog

/**//// <summary>
/// Add the javascript method showModalDialog to button
/// </summary>
/// <param name="button">The control, must be a button</param>
/// <param name="strUrl">The page url, including query string</param>
/// <param name="intWidth">Width of window</param>
/// <param name="intHeight">Height of window</param>
public static void AddShowDialog(System.Web.UI.WebControls.Button button, string strUrl, int intWidth, int intHeight)

{
string strScript = "";
strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
strScript += "var strName ='';";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

strScript += "window.showModalDialog(\'" + strUrl + "\',window,strFeatures);return false;";

button.Attributes.Add("onClick", strScript);
}
#endregion


Static AddShowDialog#region Static AddShowDialog

/**//// <summary>
/// Add the javascript method showModalDialog to button
/// </summary>
/// <param name="button">The control, must be a link button</param>
/// <param name="strUrl">The page url, including query string</param>
/// <param name="intWidth">Width of window</param>
/// <param name="intHeight">Height of window</param>
public static void AddShowDialog(System.Web.UI.WebControls.LinkButton button, string strUrl, int intWidth, int intHeight)

{
string strScript = "";
strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
strScript += "var strName ='';";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

strScript += "window.showModalDialog(\'" + strUrl + "\',strName,strFeatures);return false;";

button.Attributes.Add("onClick", strScript);
}
#endregion


Static AddShowDialog#region Static AddShowDialog

/**//// <summary>
/// Add the javascript method showModalDialog to button
/// </summary>
/// <param name="button">The control, must be a button</param>
/// <param name="strUrl">The page url, including query string</param>
/// <param name="intWidth">Width of window</param>
/// <param name="intHeight">Height of window</param>
public static void AddShowDialog(System.Web.UI.WebControls.ImageButton button, string strUrl, int intWidth, int intHeight)

{
//string strScript = "";
//strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
//strScript += "var strName ='';";

//if (strUrl.Substring(0, 1) == "/")
//{
// strUrl = strUrl.Substring(1, strUrl.Length - 1);
//}

//strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

//strScript += "window.showModalDialog(\'" + strUrl + "\',window,strFeatures);return false;";

//button.Attributes.Add("onClick", strScript);
AddShowDialog(button, strUrl, intWidth, intHeight, false);
}
#endregion

public static void AddShowDialog(System.Web.UI.WebControls.ImageButton button, string strUrl, int intWidth, int intHeight, bool isRefreshParentPage)

{
if (isRefreshParentPage)

{
string strScript = "";
strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
strScript += "var strName ='';";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

strScript += "window.showModalDialog(\'" + strUrl + "\',window,strFeatures);return true;";

button.Attributes.Add("onClick", strScript);
}
else

{
string strScript = "";
strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
strScript += "var strName ='';";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

strScript += "window.showModalDialog(\'" + strUrl + "\',window,strFeatures);return false;";

button.Attributes.Add("onClick", strScript);

}
}


Static OpenWindow#region Static OpenWindow

/**//// <summary>
/// Use "window.open" to popup the window
///
///
/// </summary>
/// <param name="strUrl">The url of window, start with "/", not "http://"</param>
/// <param name="intWidth">Width of popup window</param>
/// <param name="intHeight">Height of popup window</param>
public static void OpenWindow(System.Web.UI.Page pageCurrent, string strUrl, int intWidth, int intHeight)

{
string strScript = "";
strScript += "var strFeatures = 'width:" + intWidth.ToString() + "px;height:" + intHeight.ToString() + "px';";
strScript += "var strName ='__WIN';";
//strScript += "alert(strFeatures);";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + strUrl;

strScript += "window.open(\"" + strUrl + "\",strName,strFeatures);";

pageCurrent.RegisterStartupScript(
System.Guid.NewGuid().ToString(),
"<script language='javascript'>" + strScript + "</script>"
);
}
#endregion


Static OpenWindow#region Static OpenWindow

/**//// <summary>
/// Use "window.open" to popup the window
///
/// </summary>
/// <param name="strUrl">The url of window, start with "/", not "http://"</param>
/// <param name="intWidth">Width of popup window</param>
/// <param name="intHeight">Height of popup window</param>
//public static void OpenWindow(UpdatePanel upParentPanel, string strUrl, int intWidth, int intHeight)
//{
// string strScript = "";
// strScript += "var strFeatures = 'width:" + intWidth.ToString() + "px;height:" + intHeight.ToString() + "px';";
// strScript += "var strName ='__WIN';";
// //strScript += "alert(strFeatures);";

//
// if (strUrl.Substring(0, 1) == "/")
// {
// strUrl = strUrl.Substring(1, strUrl.Length - 1);
// }
//

// strUrl = BaseUrl + strUrl;

// strScript += "window.open(\"" + strUrl + "\",strName,strFeatures);";

// ScriptManager.RegisterStartupScript(upParentPanel, upParentPanel.GetType(), Guid.NewGuid().ToString(),
// "<script language='javascript'>" + strScript + "</script>", false
// );
//}
#endregion


Static ShowDialog#region Static ShowDialog

/**//// <summary>
/// Use "window.showModalDialog" to show the dialog
///
///
/// </summary>
/// <param name="strUrl">The url of dialog, start with "/", not "http://"</param>
/// <param name="intWidth">Width of dialog</param>
/// <param name="intHeight">Height of dialog</param>
public static void ShowDialog(System.Web.UI.Page pageCurrent, string strUrl, int intWidth, int intHeight)

{
string strScript = "";
strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
strScript += "var strName ='';";

if (strUrl.Substring(0, 1) == "/")

{
strUrl = strUrl.Substring(1, strUrl.Length - 1);
}

strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

//strScript += "window.showModalDialog(\"" + strUrl + "\",strName,strFeatures);";
strScript += "window.showModalDialog(\"" + strUrl + "\",window,strFeatures); ";

pageCurrent.RegisterStartupScript(
System.Guid.NewGuid().ToString(),
"<script language='javascript'>" + strScript + "</script>"
);
}
#endregion


Static ShowDialog#region Static ShowDialog

/**//// <summary>
/// Use "window.showModalDialog" to show the dialog
///
///
/// </summary>
/// <param name="strUrl">The url of dialog, start with "/", not "http://"</param>
/// <param name="intWidth">Width of dialog</param>
/// <param name="intHeight">Height of dialog</param>
//public static void ShowDialog(UpdatePanel upParentPanel, string strUrl, int intWidth, int intHeight)
//{
// string strScript = "";
// strScript += "var strFeatures = 'dialogWidth=" + intWidth.ToString() + "px;dialogHeight=" + intHeight.ToString() + "px;center=yes;help=no;status=no';";
// strScript += "var strName ='';";

//
// if (strUrl.Substring(0, 1) == "/")
// {
// strUrl = strUrl.Substring(1, strUrl.Length - 1);
// }
//
// strUrl = BaseUrl + "DialogFrame.aspx?URL=" + strUrl;

// //strScript += "window.showModalDialog(\"" + strUrl + "\",strName,strFeatures);";
// strScript += "window.showModalDialog(\"" + strUrl + "\",window,strFeatures); ";

// ScriptManager.RegisterStartupScript(upParentPanel, upParentPanel.GetType(), Guid.NewGuid().ToString(),
// "<script language='javascript'>" + strScript + "</script>", false);
//}
#endregion


Static SetGridStyle#region Static SetGridStyle

/**//// <summary>
/// Set the style of GridView.
/// You may call "base.SetGridStyle(MyGridId)" to set the style. So the application has the same grid style.
/// Note: Do not set any style of your GridView, and only use this method.
/// Created :
/// Modified:
/// </summary>
/// <param name="objGrid"></param>
public static void SetGridStyle(System.Web.UI.WebControls.GridView objGrid)

{


DateTime DT = new DateTime();
for (int i = 0; i < objGrid.Rows.Count; i++)

{
for (int j = 0; j < objGrid.Rows[i].Cells.Count; j++)

{
if (DateTime.TryParse(objGrid.Rows[i].Cells[j].Text, out DT))

{
if (DT.Year == DateTime.Parse("0001-1-1 0:00:00").Year)

{
objGrid.Rows[i].Cells[j].Text = "--";
}
}
}

}
//Grid Style
//objGrid.BorderColor = System.Drawing.Color.FromName("#348AA1");
//objGrid.BorderWidth = 1;
//objGrid.BorderStyle = BorderStyle.Solid;
//objGrid.CellPadding = 3;
//objGrid.CellSpacing = 1;
//objGrid.GridLines = GridLines.None;


/**/////Row Style
//objGrid.RowStyle.ForeColor = System.Drawing.Color.FromName("#000000");
//objGrid.RowStyle.BackColor = System.Drawing.Color.FromName("#FFFFFF");

//AlternatingRowStyle
//objGrid.AlternatingRowStyle.ForeColor = System.Drawing.Color.FromName("#000000");
//objGrid.AlternatingRowStyle.BackColor = System.Drawing.Color.FromName("#E8E8E8");

//HeaderStyle
//if (objGrid.HeaderRow != null)
//{
// objGrid.HeaderRow.Height = 20;
// objGrid.HeaderStyle.Font.Bold = true;
// objGrid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
// objGrid.HeaderStyle.BackColor = System.Drawing.Color.FromName("#348AA1");
// objGrid.HeaderStyle.ForeColor = System.Drawing.Color.FromName("#FFFFFF");

//}

//SelectedRow
objGrid.SelectedRowStyle.Font.Bold = true;

//PagerStyle
//objGrid.PagerStyle.HorizontalAlign = HorizontalAlign.Right;

//MouseOver color
foreach (GridViewRow row in objGrid.Rows)

{
//Selected,#E2DED6
row.Attributes.Add("onMouseOver", "this.style.background='#d7e1e6'");

if (row.RowIndex % 2 != 0)

{
//Alternating Row
row.Attributes.Add("onMouseOut", "this.style.background='#F3F3F3'");
}
else

{
//Normal Row
row.Attributes.Add("onMouseOut", "this.style.background='#e8e8e8'");
}
}

//objGrid.EmptyDataText = "没有找到符合条件的数据!";
}

public static void SetGridStyle(System.Web.UI.WebControls.GridView objGrid, string strEmptyData)

{

//Grid Style
objGrid.BorderColor = System.Drawing.Color.FromName("#348AA1");
objGrid.BorderWidth = 1;
objGrid.BorderStyle = BorderStyle.Solid;
objGrid.CellPadding = 3;
objGrid.CellSpacing = 1;
objGrid.GridLines = GridLines.None;


/**/////Row Style
objGrid.RowStyle.ForeColor = System.Drawing.Color.FromName("#000000");
objGrid.RowStyle.BackColor = System.Drawing.Color.FromName("#FFFFFF");

//AlternatingRowStyle
objGrid.AlternatingRowStyle.ForeColor = System.Drawing.Color.FromName("#000000");
objGrid.AlternatingRowStyle.BackColor = System.Drawing.Color.FromName("#E8E8E8");

//HeaderStyle
if (objGrid.HeaderRow != null)

{
objGrid.HeaderRow.Height = 20;
objGrid.HeaderStyle.Font.Bold = true;
objGrid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
objGrid.HeaderStyle.BackColor = System.Drawing.Color.FromName("#348AA1");
objGrid.HeaderStyle.ForeColor = System.Drawing.Color.FromName("#FFFFFF");

}

//SelectedRow
objGrid.SelectedRowStyle.Font.Bold = true;

//PagerStyle
objGrid.PagerStyle.HorizontalAlign = HorizontalAlign.Right;

//MouseOver color
foreach (GridViewRow row in objGrid.Rows)

{
//Selected,#E2DED6
row.Attributes.Add("onMouseOver", "this.style.background='#E2DED6'");

if (row.RowIndex % 2 != 0)

{
//Alternating Row
row.Attributes.Add("onMouseOut", "this.style.background='#E8E8E8'");
}
else

{
//Normal Row
row.Attributes.Add("onMouseOut", "this.style.background='#FFFFFF'");
}
}
objGrid.EmptyDataText = strEmptyData;
}
#endregion


Static SetTreeStyle#region Static SetTreeStyle

/**//// <summary>
/// Set the style of TreeView.
/// You may call "base.SetTreeStyle(MyTreeId)" to set the style. So the application has the same tree style.
/// Note: Do not set any style of your TreeView, and only use this method.
///
/// </summary>
/// <param name="objTree"></param>
public static void SetTreeStyle(System.Web.UI.WebControls.TreeView objTree)

{
objTree.ShowLines = true;
objTree.BackColor = System.Drawing.Color.FromName("#FFFFFF");
objTree.BorderColor = System.Drawing.Color.FromName("#5D7B9D");
objTree.BorderStyle = BorderStyle.Solid;
objTree.BorderWidth = 1;
objTree.SelectedNodeStyle.BackColor = System.Drawing.Color.LightGray;

string strStyle = string.Empty;
strStyle += "overflow:auto;";
strStyle += "scrollbar-face-color: #ffffff;";
strStyle += "scrollbar-highlight-color: #5D7B9D;";
strStyle += "scrollbar-shadow-color: #5D7B9D;";
strStyle += "scrollbar-3dlight-color: #ffffff;";
strStyle += "scrollbar-arrow-color: #5D7B9D;";
strStyle += "scrollbar-track-color: #ffffff;";
strStyle += "scrollbar-darkshadow-color: #ffffff;";
objTree.Attributes.Add("style", strStyle);
}
#endregion


Static ValidateTxtLength()#region Static ValidateTxtLength()

/**//// <summary>
/// Use "window.showModalDialog" to show the dialog
///
/// </summary>
/// <param name="pageCurrent">This page obj</param>
/// <param name="CsValidator">The CustomValidator which validate to a textbox </param>
/// <param name="maxLength">the allow input length</param>
public static void ValidateTxtLength(System.Web.UI.Page pageCurrent, System.Web.UI.WebControls.CustomValidator CsValidator, int maxLength)

{
CsValidator.ClientValidationFunction = CsValidator.ID + "_ValidateValueLength";
StringBuilder strScript = new StringBuilder();
strScript.Append("function " + CsValidator.ID + "_ValidateValueLength(source, arguments){");
strScript.Append("var ValidStrLength=");
strScript.Append(maxLength.ToString());
strScript.Append(";");
strScript.Append("if (arguments.Value.length<=ValidStrLength){");
strScript.Append("arguments.IsValid = true;}");
strScript.Append("else {");
strScript.Append("arguments.IsValid = false;}");
strScript.Append("}");
pageCurrent.RegisterStartupScript(
System.Guid.NewGuid().ToString(),
"<script language='javascript'>" + strScript.ToString() + "</script>"
);
}
#endregion


public static void BindEnumValue(SortedList SLKeyValue, DropDownList Targeddl)

{
Targeddl.Items.Clear();
for (int i = 0; i < SLKeyValue.Count; i++)

{
Targeddl.Items.Add(new ListItem(SLKeyValue.GetValueList()[i].ToString(), SLKeyValue.GetKeyList()[i].ToString()));
}
}


/**//// <summary>
/// 绑定GridView时显示表头
/// </summary>
/// <param name="sgv"></param>
//public static void BindNullSGridView(SGridView sgv)
public static void BindNullSGridView(GridView sgv)

{
if (sgv != null)

{
if (sgv.Rows.Count == 0)//在gridview的数据为空的情况下显示gird的title

{
//排序冲突 Leo.Wu
sgv.AllowSorting = false;
DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dt.Rows.Add(dr);
sgv.DataSource = dt;
try

{
sgv.DataBind();//数据为空,此时会报错,但是grid的标题会显示出来
}
catch

{
//不做处理
}
if (sgv.Rows.Count > 0)

{
sgv.Rows[0].Visible = false;
}
}
else

{
}

}
}


/**//// <summary>
/// 设置页面点击Enter键后触发的按钮事件
/// </summary>
/// <param name="pageCurrent">页面对象</param>
/// <param name="strButtonClientID">按钮的客户端ID</param>
/// <remarks>Add By Herry.Wan</remarks>
public static void SetDefaultButton(System.Web.UI.Page pageCurrent, string strButtonClientID)

{
pageCurrent.RegisterStartupScript(Guid.NewGuid().ToString(), "<script language=\"javascript\"> function document.onkeydown() { var e=event.srcElement;if(event.keyCode==13){ try{document.getElementById('" + strButtonClientID + "').click();return false;}catch(e){} }}</script>");
}


Float the element of the window#region Float the element of the window

/**//// <summary>
/// Float the element of the window
/// </summary>
/// <param name="pageCurrent"></param>
/// <param name="TargetControlClientID"></param>
/// <param name="StartLocationX"></param>
/// <param name="StartLocationY"></param>
/// <remarks> Gerry.Liang</remarks>
public static void SetElementFloatAndScroll(Page pageCurrent, string TargetControlClientID, int StartLocationX, int StartLocationY)

{
string strScript = @"
<script type='text/javascript'>
function MoveDivOnTime( )
{
var divfloat=document.getElementById('" + TargetControlClientID + @"');
divfloat.className='FloatElement';
var startY =" + StartLocationY + @";
var y = document.documentElement.scrollTop + startY ;
divfloat.style.posLeft =" + StartLocationX + @";
divfloat.style.posTop = y;
if(divfloat.children.length!=2)
{
var iframeback=document.createElement('<iframe src=about:blank frameborder=0 style=position:absolute;z-index:-1;></iframe>');
divfloat.children[0].insertAdjacentElement('afterEnd', iframeback);
iframeback.style.top=0;
iframeback.style.left=0;
iframeback.style.width=divfloat.children[0].offsetWidth;
iframeback.style.height=divfloat.children[0].offsetHeight;
iframeback.style.zIndex=-1;
}
}
function window_onload()
{
setInterval('MoveDivOnTime( )',100);
}
</script>";
pageCurrent.ClientScript.RegisterClientScriptBlock(pageCurrent.GetType(), Guid.NewGuid().ToString(), strScript);
(pageCurrent.Form.Parent as HtmlGenericControl).Attributes.Add("onload", "window_onload()");
}

#endregion
}

posted @
2007-06-27 09:42
jhtchina
阅读(
979)
评论()
收藏
举报