2012-05-17 37 views
0
I'm using struts 2 application where 
< s: form name="myForm"> 
< s:include value = "test.jsp" ></s:include> 
< img src="../../images/next.png" onclick="fnNext();"/> 
</s:form> 

test.jsp contains a table with id = "my table" 

如何使用表的ID在javascript函數fnNext():獲得包括JSP的價值JS現在

+1

與任何其他DOM元素相同。 –

回答

0

你可以使用element = document.getElementById(id)或使用jQuery使用$('#your_id')

-1

如果選擇它您查看產生的JSP的來源,您可以看到include標記包含原始JSP中的test.jsp的輸出。

因此,你可以簡單地得到表像任何其他的DOM元素,在你的js文件:

table = document.getElementById(idOfYourTable); 

希望這有助於!