我正在使用.htaccess阻止一个文件夹,这是我以前从未使用过的,我遇到了一些麻烦.这就是我所拥有的
.htaccess(位于我想要阻止的文件夹中):
AuthName "Username and password required"
AuthUserFile /.htpasswd
Require valid-user
AuthType Basic
Run Code Online (Sandbox Code Playgroud)
.htpasswd(位于root,密码在实际文件中加密):
tim:blah
Run Code Online (Sandbox Code Playgroud)
我有500个内部服务器错误,我无法弄清楚原因.
简单的问题,毫无疑问是一个简单的解决方案 - 尽管在搜索SO和谷歌一段时间后,我仍然很难找到它.
我所要做的就是拿一段文字" 我对增强的列表或高级档案感兴趣,(我们团队的一名成员将及时回复更多信息) "并将其与支票右侧对齐框(文字左对齐),但不像现在一样环绕它.
这是我的JSFiddle
代码(使用PureCSS进行样式设计):
<form class="pure-form pure-form-aligned">
<fieldset>
<div class="pure-control-group">
<label for="name">Product Name</label>
<input id="name" type="text" placeholder="Username">
</div>
<div class="pure-control-group">
<label for="password">Contact Name</label>
<input id="password" type="text" placeholder="Password">
</div>
<div class="pure-control-group">
<label for="email">Contact Email</label>
<input id="email" type="email" placeholder="Email Address">
</div>
<div class="pure-control-group">
<label for="foo">Website</label>
<input id="foo" type="text" placeholder="Enter something here...">
</div>
<div class="pure-control-group">
<label for="foo">Description:</label>
<textarea id="description" type="text" placeholder="Enter description here..."></textarea>
</div>
<div class="pure-controls">
<label for="cb" class="pure-checkbox">
<input id="cb" type="checkbox">
I'm interested in an enhanced listing …Run Code Online (Sandbox Code Playgroud) 我遇到了一个非常简单的脚本,包括文本框,按钮和项目列表.单击该按钮可将文本框值添加到列表中.但是,出于某种原因,文本将作为纯文本附加,而不是作为li元素的内部.的jsfiddle
<form>
<input type="text" class="form-control" placeholder="Task" id="text_task">
<button type="submit" id="btn_add_task" class="btn btn-primary">Add Task</button>
</form>
<ul id = "list_tasks">
</ul>
Run Code Online (Sandbox Code Playgroud)
JS:
function $(element) {
return document.getElementById(element);
}
var taskSubmit = $('btn_add_task');
var taskBox = $('text_task');
var taskList = $('list_tasks');
taskSubmit.addEventListener('click', function(e) {
e.preventDefault();
var task = taskBox.value.trim();
var newLI = document.createElement('li');
var element = newLI.appendChild(document.createTextNode(task));
taskList.appendChild(element);
taskBox.value = '';
}, false);
Run Code Online (Sandbox Code Playgroud) 我想要验证URL而不要求用户输入"http://".如果在下面的表格中,必须输入"http://"才能提交表格.我无法弄清楚如何做到这一点.任何帮助将非常感激.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Makes "field" required and a url.</title>
<link rel="stylesheet" href="http://jquery.bassistance.de/validate/demo/site-demos.css">
</head>
<body>
<form id="myform">
<label for="field">Required, URL: </label>
<input class="left" id="field" name="field">
<br/>
<input type="submit" value="Validate!">
</form>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://jquery.bassistance.de/validate/jquery.validate.js"></script>
<script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>
<script>
// just for the demos, avoids form submit
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});
$( "#myform" ).validate({
rules: {
field: {
required: true,
url: true
}
}
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
编辑:接受伊舍伍德的建议:
var txt = $('#website').val();
var http = txt.indexOf('http://'); …Run Code Online (Sandbox Code Playgroud) 我有三个图像(例如tab1.jpg)以及鼠标悬停图像(例如tab1m.jpg),我试图将其缩减为单个JQuery悬停功能.在我使用之前:
$('#tab1').hover(function(){
$(this).attr("src", 'images/tab1m.jpg');
},
function(){
$(this).attr("src", 'images/tab1.jpg');
});
$('#tab2').hover(function(){
$(this).attr("src", 'images/tab2m.jpg');
},
function(){
$(this).attr("src", 'images/tab2.jpg');
});
$('#tab3').hover(function(){
$(this).attr("src", 'images/tab3m.jpg');
},
function(){
$(this).attr("src", 'images/tab3.jpg');
});
Run Code Online (Sandbox Code Playgroud)
哪个有效,但是不必要的冗长和冗长.所以我尝试将其更改为:
$('.navimg').hover(function(){
var tab = ($(this).attr('id')).substring(3,4);
$(this).attr('src','images/tab'+tab+'m.jpg');
},
function(){
$(this).attr('src','images/tab'+tab+'.jpg');
});
Run Code Online (Sandbox Code Playgroud)
没有工作 - 当我鼠标悬停在图像上时,它成功更改但不会恢复为原始(tab1.jpg/tab2/tab3)图像.谁能告诉我为什么会这样?谢谢!
我正在寻找一种方法来查询我的数据库并按字母顺序排列结果,但如果条目以"The"开头,则跳过它,而是沿着下一个单词的第一个字母按字母顺序排列.
是否可以使用SQL查询执行此操作,或者我是否需要使用某些PHP来过滤以"The"开头的条目,然后重新组装它们?
我已经搜索了这个问题的解决方案,但是当搜索的主要关键字是文字"THE"时,很难找到结果.任何帮助将非常感激!
我正在构建一个响应式导航菜单,我在调用jQuery的slideToggle()时无法使导航项变得可见.菜单项(.nav_item)适当折叠,然后在视口<640px时变为不可见,第一个菜单项(#nav_menu)"菜单"则成为唯一可见的项目.单击后,我希望按钮重新出现并在菜单按钮下滑动.但是,当我点击时,没有任何反应,菜单项仍然不可见.如果我display: none !important;从菜单项中取出,它们会成功切换(但始终可见).有谁知道出了什么问题?谢谢.
CSS(指南针):
#navUL {
@include background-image(linear-gradient($blue_dark, $blue_light));
text-align: center;
}
#navUL li {
a:link, a:visited {
color: white;
text-decoration: none;
display: block;
height: 40px;
padding: 0 25px 0 25px;
}
a:hover {
@include background-image(linear-gradient($red_dark, $red_light));
}
display: inline-block;
color: white;
line-height: 40px;
font-family: Helvetica;
}
#nav_menu {
display: none !important;
}
@media only screen and (max-width: 640px) {
#nav_menu {
display: inline !important;
}
.nav_item {
display: none !important;
}
#navUL li {
display: inline;
} …Run Code Online (Sandbox Code Playgroud) 我的MySQL查询遇到了一些麻烦:
$statement = $conn->prepare
("SELECT * FROM ext where `approved` = 0
and `account-type`= 2
AND `ext-name` LIKE :search OR description LIKE :search");
Run Code Online (Sandbox Code Playgroud)
查询的LIKE部分有效 - 它确实返回与正确关键字对应的条目.但是,它返回的条目是每个account-type- 它不会过滤到只有account-type2 的条目.
我有一种感觉,这是我在使用SQL语句时出错了,但是如果它与我的PHP有关,那么这里是完整的代码片段:
$statement = $conn->prepare("SELECT * FROM ext where `approved` = 0 and `account-type`= 2 AND `ext-name` LIKE :search OR description LIKE :search");
$statement->bindValue(':search', "%{$keyword}%");
$statement->execute();
$exchanges = $statement->fetchAll();
Run Code Online (Sandbox Code Playgroud)