我是jQuery的新手.试图隐藏第一个div并显示第二个div.当我再次点击第二个div时,它会显示第一个div.
这是我的代码.
$(".c1").on('click', function() {
$(".one").fadeIn();
$(".two").fadeOut();
});
$(".c2").on('click', function() {
$(".two").fadeIn();
$(".one").fadeOut();
});
Run Code Online (Sandbox Code Playgroud)
.right {
font-size: 20px;
float: right;
margin-right: 50px;
}
.ab-container {
margin-bottom: 50px;
}
.container {
padding: 30px 60px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div class="ab-container one">
<div class="ab-head">
<h1>This is div 1 <a href="" class="right c1"> Click to see div 2</a></h1>
</div>
<div class="ab-content">
<p>In publishing and graphic design, lorem ipsum is a filler text or greeking commonly used to demonstrate </p>
</div>
</div>
<div …
Run Code Online (Sandbox Code Playgroud)我想要一个 JavaScript Map的单一类型或接口。
给出基本代码:
const things = new Map();
Run Code Online (Sandbox Code Playgroud)
我当前创建一种类型和一种接口来显式键入things
变量和Map
构造函数调用。
type Things = Map<string, ThingValue>;
interface ThingValue {
label: string;
count: number;
}
const things: Things = new Map<string, ThingValue>();
Run Code Online (Sandbox Code Playgroud)
我想要一个单一的类型或接口,这样我就不必重复<string, ThingValue>
。
这可能吗?或者,输入 JavaScript 的最佳实践是什么Map
?
我的目录结构如下:
我如何从上级目录中的login.php设置cookie,以便可以在homepage.php中使用它们。
我尝试setcookie("userid",$row["userid"],time()+3600,"../");
设置cookie,并且print_r($_COOKIE);
在homepage.php中不显示任何cookie
我制作了这个html css文件.我想将黄色div(id = map)放入父div(id = main)中,但是这个黄色div不会进入父div.我不知道该怎么办 .请帮我解决这个问题.
<html>
<head>
<meta charset="UTF-8"/>
<title>My Real Project</title>
<style>
*{
margin:0;
padding:0;
}
#container{
position:absolute;
width:100%;
height:100%;
}
#header{
position:relative;
width:1000px;
height:170px;
margin: 0 auto;
background-color:lightgreen;
}
#footer{
position:relative;
width:1000px;
height:170px;
margin: 0 auto;
background-color:lightblue;
bottom:0;
}
#main{
position:relative;
width:1000px;
height:600px;
background-color:darkred;
margin: 0 auto;
z-index:1;
}
#tools{
position:relative;
left:0;
background-color:orange;
width:260px;
height:100%;
z-index:2;
}
#map{
position:relative;
right:0;
width:740px;
height:100%;
z-index:2;
background-color:yellow;
}
</style>
<script>
</script>
</head>
<body>
<div id="container">
<div id="header">Place the header …
Run Code Online (Sandbox Code Playgroud) 我在php循环中有一个表单,如果数据库中有3个元素,则有3个具有相同名称的表单.这些表单包含一个具有相同名称的按钮.所以一切都喜欢这样:
<form id="test">
<button id="testbutton"></button>
</form>
<form id="test">
<button id="testbutton"></button>
</form>
<form id="test">
<button id="testbutton"></button>
</form>
Run Code Online (Sandbox Code Playgroud)
当我尝试从javascript调用.on或.click函数时出现问题.它只工作一次.
这是JS代码:
$(document).ready(function () {
$('#testbutton').on("click", function() {
function();
});
});
Run Code Online (Sandbox Code Playgroud)
该按钮淡出某些具有不同名称的div.