如何使用相应的currentItemId获取元素的值
我有 currentItemId
。我想使用 currentItemId
获取元素的值(其中包含 currentItemId
)。是否可以?
目前我正在使用此代码:
function Custom_AddListMenuItems(m, ctx)
{
current = currentItemID;
var temp1 = document.getElementById('current');
alert(temp1);
CAMOpt(m,'AssetDetails (new window)','javascript:window.open(\'http://infpw03403:15000/Lists/Asset%20Repository/DispForm.aspx?ID='+temp1+'\')','/_layouts/images/LIST.GIF');
return false;
}
如果有任何其他方法,请告诉我。
I have currentItemId
. I want to use currentItemId
to get value of element (which contains currentItemId
). Is it possible?
Currently I am using this code:
function Custom_AddListMenuItems(m, ctx)
{
current = currentItemID;
var temp1 = document.getElementById('current');
alert(temp1);
CAMOpt(m,'AssetDetails (new window)','javascript:window.open(\'http://infpw03403:15000/Lists/Asset%20Repository/DispForm.aspx?ID='+temp1+'\')','/_layouts/images/LIST.GIF');
return false;
}
If there is any other method please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将变量(当前)传递给 getElementById 而不是字符串“current”
You'll need to pass the variable(current) to getElementById instead of the string 'current'
在 HTML 页面中,元素必须具有 id="currentItemId"。
那么只有您可以使用
var temp1 = document.getElementById(currentItemId).value;
In your HTML page the element must have its id="currentItemId".
Then only you can use
var temp1 = document.getElementById(currentItemId).value;