在我的一个项目中,我制作了3个画廊,但是我想将它们放在同一个页面上,而不是同时放在同一个页面上.为了实现这一点,我选择了创建3个按钮.例如,当我点击第一个按钮时,应该出现第一个图库(两个图库最初都在显示:none),然后当我点击第二个按钮时,第二个按钮应该出现,之前显示的那个应该消失,所以为每个画廊.我制作了页面的简化副本,使思考更容易.
一般来说,我的问题是我不太清楚如何将函数应用于数组中的所有元素,除了一个元素.
这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Galleries</title>
<link rel="stylesheet" type="text/css" href="gs.css">
<style type="text/css">
body{
background-color:royalblue;
}
header{
text-align: center;
}
article{
width:95%;
margin:auto 2.5% auto 2.5%;
height:850px;
background-color:tomato;
display:none;
}
</style>
</head>
<body>
<header>
<button>Third Gallery</button>
<button>Second Gallery</button>
<button>Third Gallery</button>
</header>
<section>
<article>
<h1>This is the first gallery</h1>
</article>
<article>
<h1>This is the second gallery</h1>
</article>
<article>
<h1>This is the third gallery</h1>
</article>
</section>
<script type="text/javascript">
var button=document.getElementsByTagName('button');
var gallery=document.getElementsByTagName('article');
for(var i=0; i<button.length; i++){
(function(index){
button[index].onclick=function(){
gallery[index].style.display="block"; …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建这个小程序来帮助我,只用一个命令,在Ubuntu的终端中编译和运行一个C程序.
为了让它变得更加漂亮,我在bash文件中添加了一个参数,这样我就可以将它用于我想要的任何C程序.所以它应该是这样的:
这是代码:
# usr/bin/bash
filename=$1
cc -o $filename "$filename.c"
./$filename.out
Run Code Online (Sandbox Code Playgroud)
几乎一切都在运行,我仍然唯一的问题是在最后一行:
./$filename.out
Run Code Online (Sandbox Code Playgroud)
它似乎没有在执行最终程序的命令中使用变量的名称.
我是bash的菜鸟(假设我几个月没用过它).
我有一个SQL问题.这是一个简单的问题,但我根本不是一个SQL人.
这是情况,我有三个表:
CUSTOMER(
PK(customer_id)
)
LOAN(
PK(loan_id),
customer_it,
behavior_id
)
BEHAVIOR(
PK(behavior_id),
unpaid_number
)
// PK(x): x is a primary key.
Run Code Online (Sandbox Code Playgroud)
我想选择所有CUSTOMERs拥有的人unpaid_number >= 1.
任何人都可以告诉我一种方法来解决这个问题吗?
谢谢