当我点击重置按钮时,我有可以重置表单的工作代码.然而,在我的代码变得越来越长之后,我意识到它不再起作用了.
<div id="labels">
<table class="config">
<thead>
<tr>
<th colspan="4"; style= "padding-bottom: 20px; color:#6666FF; text-align:left; font-size: 1.5em">Control Buttons Configuration</th>
</tr>
<tr>
<th>Index</th>
<th>Switch</th>
<th>Response Number</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<form id="configform" name= "input" action="#" method="get">
<tr><td style="text-align: center">1</td>
<td><img src= "static/switch.png" height="100px" width="108px"></td>
<td id="small"><input style="background: white; color: black;" type="text" value="" id="number_one"></td>
<td><input style="background: white; color: black;" type="text" id="label_one"></td>
</tr>
<tr>
<td style="text-align: center">2</td>
<td><img src= "static/switch.png" height="100px" width="108px"></td>
<td id="small"><input style="background: white; color: black;" type="text" id = "number_two" value=""></td>
<td><input …
Run Code Online (Sandbox Code Playgroud) bigloop=setInterval(function () {
var checked = $('#status_table tr [id^="monitor_"]:checked');
if (checked.index()===-1 ||checked.length===0 || ){
bigloop=clearInterval(bigloop);
$('#monitor').button('enable');
}else{
(function loop(i) {
//monitor element at index i
monitoring($(checked[i]).parents('tr'));
//delay of 3 seconds
setTimeout(function () {
//when incremented i is less than the number of rows, call loop for next index
if (++i < checked.length) loop(i);
}, 3000);
}(0)); //start with 0
}
}, index*3000); //loop period
Run Code Online (Sandbox Code Playgroud)
我有上面的代码,有时它工作,有时它不是.我想知道clearInterval是否真的清除了计时器?因为有这个monitor
按钮只有在它monitoring
起作用时才会被禁用.clearInterval
当.outputRemove
点击一个被调用的元素时,我有另一个.请参阅以下代码:
//remove row entry in the …
Run Code Online (Sandbox Code Playgroud) 我有这个if-else语句给了我奇怪的回应......每当我首先选择"输出"时,之后没有其他选择可以出现...仅供参考,我使用多选我所以我可以选择并显示我想要的数量.
$('#outputText').hide();
$('#armCB').hide();
$('#outputCB').hide();
$('#zoneText').hide();
$('#counterText').hide();
$('#flagText').hide();
$('#sensorText').hide();
('#select-choice-1').change(function(){
if ($('#output').is(':selected')){
$('#outputText').show();
}
else if ($('#arm').is(':selected')){
$('#armCB').show();
}
else if ($('#zone').is(':selected')){
$('#zoneText').show();
}
else if ($('#counter').is(':selected')){
$('#counterText').show();
}
else if ($('#flag').is(':selected')){
$('#flagText').show();
}
else if ($('#sensor').is(':selected')){
$('#sensorText').show();
}
else{
$('#outputText').hide();
$('#armCB').hide();
$('#zoneText').hide();
$('#counterText').hide();
$('#flagText').hide();
$('#sensorText').hide();
}
Run Code Online (Sandbox Code Playgroud)
我的if-else声明中有错误吗?或者我必须在这里使用Switch case语句吗?如果是这样,我该怎么办?
HTML:
<div id="display" style=" clear:both">
<div class="left" style="float:left; width:48%">
<div data-role="fieldcontain">
<label for="select-choice-1" class="select">Select Category</label>
<select name="select-choice-1" id="select-choice-1" data-native-menu="false" data-mini="true" multiple="multiple" size="2">
<option value="arm" id="arm">Arm</option>
<option value="zone" id="zone">Zone Input</option>
<option value="output" id="output">Output</option> …
Run Code Online (Sandbox Code Playgroud) 我可以在表格中添加一个字符串来显示状态
$('#test').empty().append("on")
Run Code Online (Sandbox Code Playgroud)
但如果我能显示图像而不是字符串会更好.我试过这个:
$('#test').empty().append(<img src="/static/on.png" height="64px" width="64px">)
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我该怎么办?
有人可以在这里为这些特殊字符示例提供更好的解释吗?或者提供一些更清晰的例子?
(X)
模式中的'(foo)'和'(bar)'/(foo)(bar)\ 1\2 /匹配并记住字符串"foo bar foo bar"中的前两个单词.模式中的\ 1和\ 2匹配字符串的最后两个单词.
小数点
例如,/.n /匹配"an"和"on"in"nay,苹果在树上",但不是'nay'.
字边界\ b
/\w\b\w /将永远不会匹配任何内容,因为单词字符永远不会被非单词和单词字符所遵循.
非字边界\ B
/\B../匹配"noonday"中的'oo'(和/y.B./匹配'ye'在"可能是昨天."完全不知道上面的例子显示了什么:(
非常感谢!
我有一个小网络应用程序(只有 1 页),允许用户输入和选择一些选项。输入的文本和选择将以表格的形式显示在另一个 div 中。您可能需要参考此处的示例:http : //jsfiddle.net/xaKXM/5/
在此小提琴中,您可以输入任何内容,单击submit
后将获得文本输入并将它们附加到另一个表中#configtableTable
$('#labels #labelTable tr:last').after(addmore);
$('#configtable #configtableTable tr:last').after(displaymore);
Run Code Online (Sandbox Code Playgroud)
我正在使用cherrypy作为迷你网络服务器(因此主要代码是用python编写的),我知道它在session
这里,但我根本不知道如何使用它,因为给出的示例并不是我真正想要看到的.
仅供参考,我根本没有使用 PHP,所有内容都在一个页面中。我只是显示和隐藏它们。但我希望页面即使在刷新后也能保持显示#configtableTable
和隐藏状态#labelTable
。请注意,小提琴只是网络应用程序的一部分,它只会在从另一台设备得到回复后才会显示所有这些。
不确定 cookie,因为我发现的所有链接似乎都已损坏。如何jQuery的会议?它适用于我的情况吗?不过我需要一些应用示例:(
好的,总结一下我的问题: 1. 我可以在刷新后保存页面状态吗?如何?上面提到的哪些方法值得一试?有什么例子可以参考吗?或任何其他建议?2.我可以在到达页面后简单地禁用刷新或返回吗?
提前谢谢大家:)
我将向设备发布一个查询,该设备将返回类似这样的内容(在读取行之后):
['\x03C?01FF00\r']
Run Code Online (Sandbox Code Playgroud)
我想只提取FF00
并将回复发布到jquery(发送查询)并将其显示在浏览器上。我怎样才能做到这一点?2 个字节的范围是 0000 到 FFFF。
编辑:回复类型是list
.
我面临一个非常奇怪的问题.这是我的代码:
<div id="status">
<div id="armStatus">
<div id="armText">
<fieldset data-role="controlgroup">
<legend>Unit</legend>
<input type="checkbox" class="CB" name="armCB_1" id="armCB_1" class="custom" data-mini="true" />
<label for="armCB_1">Arming Status</label>
<p id="armingtext"></p>
</fieldset>
</div>
</div>
<table class="config" id="status_table">
<thead>
<tr>
<th colspan="4"; style= "padding-bottom: 20px; color:#6666FF; text-align:left; font-size: 1.5em">Feedback Status</th>
</tr>
<tr>
<th>Index</th>
<th>Feedback Type</th>
<th>Feedback Number</th>
<th>Status</th>
<th class="cHide">Monitor?</th>
<th class="cHide">Remove?</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
<button type="button" id="monitor" class="cHide" data-role="button" data-mini="true" data-transition="fade">Monitor</button>
</div>
Run Code Online (Sandbox Code Playgroud)
如上所示,该按钮与2个表头monitor
具有相同的类并且'remove?`.但是当这个叫做:.cHide
monitor?
$(".cHide").hide();
Run Code Online (Sandbox Code Playgroud)
只隐藏了monitor?
和remove?
列,但monitor …
场景:我有一个Web应用程序,我将让用户1在表单(#div1
)中设置一些值并将其显示给下一个用户(在用户1之后没有关闭浏览器来到浏览器)(显示将显示在#div2
而#div1
将被隐藏).但是,如果用户2刷新浏览器,则所有值都将消失.
问题:如何在用户尝试刷新浏览器时提醒用户?Web应用程序将打开Midori
,Web服务器将打开CherryPy
.
或者有没有办法保存会话而不管刷新?如何?
jquery ×8
javascript ×7
python ×2
cherrypy ×1
forms ×1
html5 ×1
if-statement ×1
python-2.7 ×1
reset ×1
setinterval ×1