<f:view id="testForm">
<h:form>
<h:commandButton id="testButton" value="submit" onclick="testfun(this.id);"></h:commandButton>
</h:form>
</f:view>对于上面的代码,如果用document.getElementById("testButton").value;是无法取得值的,必须要document.getElementById("testForm:testButton").value.因为源代码中组件的id已经被改为testForm:testButton了,但是现在我需要自己指定组件的id,比如上面的testButton,该怎么做??