我正在尝试获取微调器的值并显示其值。这是微调器代码:
<div id="site_content">
<div id="content">
<h:body>
<h:form>
<div class="whiteSpace" />
<p:spinner id="minutes" min="0" max="1000" value="#{printerSettings.t}" size="1">
<p:ajax update="NewTime" />
<f:validateLongRange minimum="1" maximum="1000" />
</p:spinner>
<h:message id="minutes2" for="minutes" style="color:red" />
这是当用户按下提交时调用的javascript代码
function Thankyou() {
var minuteVal = $('minutes').val(); //not finding the minutes selected
alert(minuteVal);
alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
//location.href = 'index.xhtml';
}
我努力了
var minuteVal = $('minutes').text();
这将返回一个空框。谢谢。
编辑
找到上面的JavaScript
</h:form>
</h:body>
</div>
</div>
<script type="text/javascript">
.....
</script>
</html>
在 XHTML 的底部。
编辑
这是来源,我不知道这意味着什么
In how many minutes time would you like to have your job sent to the printer ?
<div class="whiteSpace"></div>
<span id="j_idt8:minutes" class="ui-spinner ui-widget ui-corner-all">
<input id="j_idt8:minutes_input" name="j_idt8:minutes_input" type="text" class="ui-spinner-input ui-inputfield ui-state-default ui-corner-all" autocomplete="off" value="1" size="1" />
<a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only">
<span class="ui-button-text">
<span class="ui-icon ui-icon-triangle-1-n"></span>
</span>
</a>
<a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only">
<span class="ui-button-text">
<span class="ui-icon ui-icon-triangle-1-s"></span>
</span>
</a>
</span>
<script id="j_idt8:minutes_s" type="text/javascript">
PrimeFaces.cw('Spinner', 'widget_j_idt8_minutes', {
id: 'j_idt8:minutes',
step: 1.0,
min: 0.0,
max: 1000.0,
behaviors: {
change: function(event) {
PrimeFaces.ab({
source: 'j_idt8:minutes',
event: 'valueChange',
process: 'j_idt8:minutes',
update: 'j_idt8:NewTime'
}, arguments[1]);
}
}
});
</script>
<span id="j_idt8:minutes2"></span>
编辑
function Thankyou()
{
var minutesVal = $('#minutes').spinner('value');//not finding the minutes selected
alert(minutesVal);
alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
//location.href = 'index.xhtml';
}
现在什么也没有发生,鼠标上的加载符号出现但没有消息框等