gpt4 book ai didi

javascript - 在我的 html 代码中创建动态 id

转载 作者:行者123 更新时间:2023-11-28 00:02:49 25 4
gpt4 key购买 nike

我从网络上获取一个插件来创建动态选项卡。我尝试根据自己的意愿调整代码,但我需要创建一个动态 ID。这里是代码:

function addNewStaticTab()
{
$.addDynaTab({
tabID : 'addstatictab',
type : 'html',
html : "<table class='fontStreet' width='100%'> <tr> <td align='left' class='td-label'>Intitulé*</td> <td width='2%'>&nbsp;</td> <td align='left' width='150'><input type='text' class='input-middle' required></td> <td> <figure onclick='makeCaptionAppear('figcaptionRosterInt');' style='position:relative; padding:0px; margin:0px;' ><img src='img/inter.png' id='buttonCriteresLeft'><figcaption class='figcaptionRoster2' id='figcaptionRosterInt' onMouseOut='makeCaptionDisappear('figcaptionRosterInt');'>Aide:<br> Exemples d'intitulés :<br>Projet, développement commercial, développement international, En création, prestataire, apporteur d'affaires, recherche d'emploi/opportunités, etc.</figcaption></figure> </td> </tr> </table>",
params : {},
tabTitle : 'NOUVELLE ACTIVITÉ'
});
}

如果 id 是“figcaptionRosterInt”,我需要将其更改为动态 id。正如你所看到的,我调用一个函数来打开另一个需要 ID 的 div 弹出窗口,但即使窗口在其他选项卡中相同,ID 也需要是唯一的..

我不知道你是否明白,对不起我的英语。

提前感谢您的回答。

最佳答案

如果我理解你的问题,你可以通过向addNewStaticTab函数

function addNewStaticTab(parameter_id)
{
$.addDynaTab({
tabID : 'addstatictab',
type : 'html',
html : "<table class='fontStreet' width='100%'> <tr> <td align='left' class='td-label'>Intitulé*</td> <td width='2%'>&nbsp;</td> <td align='left' width='150'><input type='text' class='input-middle' required></td> <td> <figure onclick='makeCaptionAppear('+ parameter_id +');' style='position:relative; padding:0px; margin:0px;' ><img src='img/inter.png' id='buttonCriteresLeft'><figcaption class='figcaptionRoster2' id='+ parameter_id +' onMouseOut='makeCaptionDisappear('+ parameter_id +');'>Aide:<br> Exemples d'intitulés :<br>Projet, développement commercial, développement international, En création, prestataire, apporteur d'affaires, recherche d'emploi/opportunités, etc.</figcaption></figure> </td> </tr> </table>",
params : {},
tabTitle : 'NOUVELLE ACTIVITÉ'
});
}

关于javascript - 在我的 html 代码中创建动态 id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31636763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com