我正在使用Struts2 Jquery插件,请看一下这段代码。
<s:iterator status="stat" value="primeDisplayLocationBeans">
<tr>
<td class="last center">
<sj:a openDialog="myremotedialog" href="opendemographicdetails?locationId=%{id}">
Demographic
</sj:a>
<sj:dialog id="myremotedialog" autoOpen="false"
title="Demographic Details" width="800"/>
</td>
</tr>
</s:iterator>现在,代码创建了一个动态链接列表,如果我单击这些链接,它将在远程dialog.But上打开相应的内容--问题是第一行链接无法工作,但所有其他链接都正常工作,打开相应的dialog.For --第一个链接甚至是对话框都没有打开。它在Java脚本控制台中显示的错误是:
无法设置未定义的属性“href”
发布于 2012-12-03 16:18:35
您将相同的ID分配给多个元素,即违反(X)HTML规范,并且不允许以后惟一地引用一个元素(有多个元素具有相同的ID)。
使用如下内容将您的ID参数化:
<s:iterator status="stat" value="primeDisplayLocationBeans">
<tr>
<td class="last center">
<sj:a openDialog="myremotedialog_%{#stat.index}"
href="opendemographicdetails?locationId=%{id}">Demographic</sj:a>
<sj:dialog id="myremotedialog_%{#stat.index}"
autoOpen="false" title="Demographic Details" width="800"/>
</td>
</tr>
</s:iterator>https://stackoverflow.com/questions/13686471
复制相似问题