我有三个字符串(当前时间,日落和日出),如何查看当前时间是否在日出和日落之间?
$current_time = "10:59 pm";
$sunrise = "5:42 am";
$sunset = "6:26 pm";
Run Code Online (Sandbox Code Playgroud)
编辑:我不明白为什么我得到这么多的选票.我想这个网站是想问你是否不能自己做点什么.
我无法弄清楚如何将时间转换为数字因为上午/下午这就是为什么我问这个问题.我没有看到任何类似的问题,所以我问道.
我想在列表项的右侧添加背景图像,并且想要从右侧添加一些填充,但我无法做到这一点.请看下面的例子:
HTML:
<ul>
<li>Hello</li>
<li>Hello world</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
CSS:
ul{
width:100px;
}
ul li{
border:1px solid orange;
background: url("arrow1.gif") no-repeat center right;
}
ul li:hover{
background:yellow url("arrow1.gif") no-repeat center right;
}
Run Code Online (Sandbox Code Playgroud)
我知道我们可以按像素设置图像位置,但由于每个li都有不同的宽度,我不能这样做.
这是JSFiddle链接:http: //jsfiddle.net/QeGAd/1/
我在容器内有多个宽度相同的物品.由于元素的高度不同,对齐存在问题,您可以在下面的图片中看到.
我希望在每个第3项之后清除而不更改html标记,以便第4项转到下一行.我正在尝试添加nth-child(3):之后,但似乎没有用.

这是代码:
HTML:
<div class="list">
<div class="item">Lorem ipsum dolor sit amet,</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
<div class="item">Lorem ipsum dolor sit amet,</div>
<div class="item">Lorem ipsum dolor sit amet,</div>
<div class="item">Lorem ipsum dolor sit amet</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.item:nth-child(3):after{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
Run Code Online (Sandbox Code Playgroud)
我想用php和mysql创建一个简单的标签系统,这样用户就可以通过表单添加几个标签.我的问题是,我应该将标签保存为单个数据库列中的数组吗?例如."tag1,tag2,tag3"..或者我应该在数据库表中有单独的列,我应该在每列中保存每个标记.我希望我的问题很明确.谢谢.
我发现本教程使用jQuery和验证插件来验证表单输入.请在此处查看工作示例. http://jsfiddle.net/nK7Pw/ 这似乎工作正常,但我有一个问题,在HTML部分,没有提到错误类,那么代码如何在每个字段前面显示错误?jQuery部分也没有这样的解释.谢谢你的解释.
我正在尝试使用jQuery验证插件通过使用自定义add.method来验证一些表单字段,我需要一些帮助.这是我的html表单.
<form method="post" action="<?=$PHP_SELF?>" name="sf" id="sf">
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" /><br />
</p>
<p>
<label for="email">Email:</label>
<input type="text" name="email" id="email" /><br />
</p>
</form>
Run Code Online (Sandbox Code Playgroud)
基本上我正在尝试一个非常基本的规则来检查Name字段是否为空.我正在尝试关注,请告诉我它是否正确?
<script type="text/javascript">
$(document).ready(function() {
$.validator.addMethod("name",function(value,element){
return this.optional(element) || (i.test(value) > 0);
},"Name is required");
$("#sf").validate({
rules: {
name: true,
},
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我想在窗体的名称字段前显示名称错误消息.我怎么能这样做?谢谢你的帮助.
我想用jQuery在输入字段中添加一些值.问题在于输入字段的ID.我正在使用id等options[input2].在那种情况下,我的代码不起作用.如果我使用ID input2,那么它工作正常.我需要使用options[input2],我该如何修复代码?
HTML:
<div>
<h3>Working</h3>
<input id="input1" type="text" value="" />
<input class="button" type="button" value="Add value" />
</div>
<div>
<h3>Not working</h3>
<input id="options[input2]" type="text" value="" />
<input class="button" type="button" value="Add value" />
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$('.button').click(function(){
var fieldID = $(this).prev().attr("id");
$('#' + fieldID).val("hello world");
});
Run Code Online (Sandbox Code Playgroud)
演示:
By looking at GitHub Gist API, I understood that it is possible to create the Gist create for anonymous users without any API keys/authentication. Is it so?
I could not find answers to following questions:
Thanks for any information about this.
我的以下代码工作正常.
$(document).ready(function() {
$('a.address').click(function() {
$('#box').slideDown("slow");
$.ajax({
type: "POST",
url: "details.php",
success: function(html){
$("#msg").html(html);
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
但是以下没有(在成功内部只改变了1行:),它没有加载任何东西..只滑动#box,而#msg里面,但是不加载#address.
$(document).ready(function() {
$('a.address').click(function() {
$('#box').slideDown("slow");
$.ajax({
type: "POST",
url: "details.php",
success: function(html){
$("#msg").html($(html).find('#address').html());
}
});
});
});
The details.php is:
<div id="info">some text.</div>
<div id="address">The address</div>
Run Code Online (Sandbox Code Playgroud) 我有一个固定的宽度div,我想在容器的右侧显示.在左侧,我想显示一个div,以便在右div结束后,其文本在右侧div下方展开.请看下面的图片:

这是我目前正在尝试的内容:
HTML:
<div class="wrapper">
<div class="left">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eu ipsum augue. </div>
<div class="right">float right.</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.wrapper{
overflow: hidden;
border: 1px solid red;
width: 300px;
}
.left{
float: left;
width: 200px;
background: brown;
}
.right{
float: right;
width: 100px;
background: green;
}
Run Code Online (Sandbox Code Playgroud)
JSFiddle: http ://jsfiddle.net/qyrKY/
我正在尝试使用css创建标签形状,使其看起来像:

我正在尝试跟随,但无法使用三角形区域的边框.
HTML:
<a href="#">Test</a>
Run Code Online (Sandbox Code Playgroud)
CSS:
a{
float: left;
height: 35px;
position:relative;
border: 1px solid red;
border-right: none;
width: 100px;
}
a:before{
content: "";
position: absolute;
top: -1px;
right: -18px;
width: 0;
height: 0;
border-color: white white white red;
border-style: solid;
border-width: 19px 0 18px 18px;
}
Run Code Online (Sandbox Code Playgroud)
JSFiddle: http ://jsfiddle.net/Sac3m/