0

如何在struts displaytag中调用javascript函数,我想将id传递给那个javascript函数。我不知道任何人帮助我..

<display:column style="text-align: center;" title="Booth No"
        property="partNo" />

在这里我怎么能调用javascript函数..

这是我的代码..

<div >
            <display:table id="boothResultsTableId"
                 name="${boothResult.perWiseboothResults}"
                defaultorder="ascending" defaultsort="4"
                style="width:auto;margin-left:1px;border:1px solid #C4DEFF;">

            <display:column style="text-align:center;" title="Polling % Range"
                    property="location" />
            <display:column style="text-align:center;" title="Total No of Booths"
                    property="votesEarned">
                    <div class="coverAll" 
                        onclick="alert('hi');">
                    </div>
            </display:column>
            <display:column style="text-align:center;" title="Party Votes %"
                    property="percentage" />
            </display:table>
            </div>
4

3 回答 3

0

<display:column style="text-align: center;" title="Booth No" property="partNo" />
<a onclick="fn(${row.id})">link</a>
</display:column>

从哪里来... row_<display:table id="row"

于 2013-02-26T23:40:02.930 回答
0

何时调用 javascript 函数?什么时候点击?

JSP

<display:column style="text-align: center;" title="Booth No" property="partNo" />
   <div class="coverAll" 
       onclick="alert('hi ! ID is ' + <s:property value="#attr.myTab.myId" />);">
      stuff inside the div
   </div>
</display:column>

CSS

.coverAll{
   width: 100%;
   height: 100%;
}
于 2013-02-26T09:11:45.843 回答
0

虽然我是 STRUTS 新手,但我阅读了 Andrea 的帖子并使用了#attr.价值理念。这可能是黑客的做法,但它奏效了。

这是我的<display.column代码:

<display:column class="textBold8" property="supplierCd" style="color:black"
    paramId="supplierCd" paramProperty="supplierCd" titleKey="supplier.supplierCd"
    sortable="true" href="javascript:openSmallWin(\'#attr.supplier.supplierId\');//">
</display:column>

这是我的 JavaScript 代码:

function openSmallWin(s) {
    // The value of 's' is selected using a .substring method in order to isolate the    actual
    // value of the supplier code. What comes into the javascript function is 
    // '?supplierCd=xxxxxxxxx#attr.supplier.suplierId'.
    // Where xxxxxxxxx is the actual value of the Supplier Code. Sorry.     
    var theUrl = "<%=request.getContextPath()%>/supplier.do? method=view&supplierCd="+s.substring(12,21);
    window.open(theUrl,"purchaseOrderWnd", 'resizable=1,scrollbars=1,width=800,height=675')
}
于 2013-03-20T15:59:18.503 回答