我有以下问题:我有一个带有三个文本输入字段的表单,我想在其中一个字段具有焦点时更改背景颜色,并在失去焦点时将其设置回.我想出了以下代码:
HTML(简化):
<form>
<input class="calc_input" type="text" name="start_date" id="start_date" />
<input class="calc_input" type="text" name="end_date" id="end_date" />
<input class="calc_input" size="8" type="text" name="leap_year" id="leap_year" />
</form>
Run Code Online (Sandbox Code Playgroud)
jQuery的
$(document).ready(function() {
$('input:text').focus(
function(){
$(this).css({'background-color' : '#FFFFEEE'});
});
$('input:text').blur(
function(){
$(this).css({'background-color' : '#DFD8D1'});
});
});
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在尝试构建一个页面,该页面在加载时仅显示标题,并且当用户单击标题时,每个标题下的表在隐藏状态和显示状态之间切换。我的约束是仅在CSS中执行此操作。
到目前为止,这是我想出的:
https://jsfiddle.net/Argoron/c1ypx24c/6/
它无法正常工作,因为每次单击标题时,其他标题下方的表都被隐藏。我要完成的工作是每个部分的行为都是独立的,例如,表1仅在单击标题1时才应更改其显示状态。
同样,不确定为什么在第3节中同时显示两个替代标题。
我想从html文件中动态删除特定标记及其内容,并考虑使用preg_replace但无法正确获取语法.基本上它应该,例如,做一些事情:在任何东西之间替换(和包括)""之间的所有东西.
请问有人帮我解决这个问题吗?
我在Firefox中偶然发现了一个奇怪的行为.我有一个动态创建的文本,我已经插入了一个包含链接的表单元素,以便能够通过post方法传递参数.理想情况下,它应该只与文本一起流动,看起来像一个普通的锚点.但是,虽然它通常在IE中显示,但Firefox会在表单之前终止段落,这会插入不需要的换行符.有没有人知道为什么会这样,并有一个解决方法/替代解决方案?
IE中的结果(ok):
<p class="article" >This is my paragraph and here goes my
<form style="display: inline" name="link_form" action="link.html" method="post">
<input type="hidden" name="lnk_id" value="1" /><a class="link" href="#" onclick="link_form.submit()">link</a></form>**</p>**
Run Code Online (Sandbox Code Playgroud)
Firefox(ko)中的结果:
<p class="article" >This is my paragraph and here goes my**</p>**
<form style="display: inline" name="link_form" action="link.html" method="post">
<input type="hidden" name="lnk_id" value="1" /><a class="link" href="#" onclick="link_form.submit()">link</a></form>
Run Code Online (Sandbox Code Playgroud)
提前致谢