如何在aspx.cs页面设置document.getElementById(progressPanel.ID)
How to set document.getElementById(progressPanel.ID) in aspx.cs page
我有javascript设置面板的位置和javascript在
function ShowProgressPanel(progresspanel)
{
var progressPanelId = document.getElementById(progressPanel.ID);
alert(progressPanelId);
if (progressPanelId != null)
{
var height = Math.min(document.documentElement.clientHeight, document.body.offsetHeight);
alert(height);
var width = Math.min(document.documentElement.clientWidth, document.body.offsetWidth);
var xPos = Math.round((width / 2) - (progressPanelId.clientWidth / 2));
var yPos = Math.round((height / 2) - (progressPanelId.clientHeight / 2));
setLocation(progressPanelId, { x: xPos, y: yPos });
}
function setLocation(element, point)
{
Sys.UI.DomElement.setLocation(element, point.x, point.y);
}
}
我正在从aspx页面传递客户端id
var progressPanel = document.getElementById('<%=_progressPanel.ClientID %>');
ShowProgressPanel(progressPanel);
设置为HTMLdiv标签。以上代码运行良好。当我通过aspx.cs页面发送时,它显示contentplace holder元素和高度未设置。
string script = string.Format(@"ShowProgressPanel('{0}');", _progressPanel.ClientID);
ScriptManager.RegisterStartupScript(this, typeof(Page), _progressPanel.ID, script, true);
但是在这两个进度面板中都放置在contentplaceholder中。如何在aspx.cs页面
你把元素和id混在一起了。
function ShowProgressPanel(progresspanelId)
{
var progressPanelElement = document.getElementById(progresspanelId);
setLocation(progressPanelElement , { x: xPos, y: yPos });
}
function setLocation(element, point)
{
Sys.UI.DomElement.setLocation(element, point.x, point.y);
}
相关文章:
- reactjs this.refs vs document.getElementById
- 如何通过adf中的document.getElementById获取inputText字段值
- 无法获取文档.GetElementById工作正常
- document.getElementById(“st”).click();不起作用
- Javascript:Can't使用getElementById获取元素
- 如何使用“;getElementById”;在一个循环中
- Javascript GetElementByID has no value
- document.getElementById并使用id名称
- document.getElementById在js中不起作用
- document.getElementById.style.backgroundImage not working
- 如何从document.getElementById()中获取UniqueID
- 从输入框、Javascript、getElementById获取值
- 什么'这个javascript代码getElementById有问题
- DOMDocument getelementbyid conflict?
- 如何从getelementbyid用javascript编写变量
- inline svg--getElementById在Opera中不起作用
- 在init function()中调用getElementById(“..”),而不是想用它做点什么的函数
- 将global.getelementbyid连接到单个变量中
- 未捕获的类型错误:未定义不是上的函数.GetElementByID
- document.getElementById(..) is null