簡體   English   中英

如何使用相應的currentItemId獲取元素的值

[英]How can get value of element using corresponding 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;
}

如果還有其他方法,請告訴我。

您需要將變量(當前)傳遞給getElementById,而不是字符串“ current”

var temp1=document.getElementById(current);
alert(temp1.value);

在HTML頁面中,元素必須具有其id =“ currentItemId”。 那只有你可以使用

var temp1 = document.getElementById(currentItemId).value;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM