实际上当我的回复来的时候我试着调用javascript文件。在我的代码中,我有切换按钮和两个div是隐藏并显示相应的切换按钮值更改。但是当第二个div显示时,想要每次调用javascript文件ajax电话。
<div class="form-group">
<h:outputLabel class="col-lg-4 control-label" value="Apply on Company"></h:outputLabel>
<div class="col-lg-5">
<div class="left marginR10">
<div class="normal-toggle-button toggle-custom-size">
<h:selectBooleanCheckbox class="nostyle" value="#{promocdbean.aplyOnCmpny}">
<f:ajax execute="@this" event="change" render="prefbyselection" />
</h:selectBooleanCheckbox>
</div>
</div>
</div>
</div> <!-- End .form-group -->
<h:panelGroup id="prefbyselection" layout="block" >
<h:panelGroup id="cmpnynm" layout="block" class="form-group" rendered="#{promocdbean.aplyOnCmpny }">
<h:outputLabel for="cmpnyname" class="col-lg-4 control-label" value="Company Name" ></h:outputLabel>
<div class="col-lg-6">
<h:outputLabel class="control-label" value="Nirula'a Corner House Private Limited" ></h:outputLabel>
</div>
</h:panelGroup>
<h:panelGroup id="locatn" layout="block" class="form-group" rendered="#{!promocdbean.aplyOnCmpny}" >
<h:outputLabel for="location" class="col-lg-4 control-label" value="Location" onfocus="loadScript()"></h:outputLabel>
<div class="col-lg-5" >
<h:selectOneMenu id="location" value="#{promocdbean.location}" class="form-control" >
<f:selectItem itemValue="77" itemLabel="Nirulas (Preet Vihar)"></f:selectItem>
<f:selectItem itemValue="76" itemLabel="Nirulas (19 Community center)"></f:selectItem>
</h:selectOneMenu>
</div>
</h:panelGroup>
</h:panelGroup>