如果输入有效(填写必填字段),我想更改按钮的颜色.如果没有javascript,我只能使用CSS和HTML来实现这一目标?
.wrapper {
display: flex;
flex-flow: row wrap;
text-align: center;
background: linear-gradient(to bottom, #F4F6F9, #D3D8E8);
font-family: Arial;
}Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
<main class="main">
<h2>Login</h2>
<form method="POST" action="main.html">
<label for="username"><b>Username:</b></label>
<input id="username" type="text" placeholder="Username" required/><br/>
<label for="password"><b>Password:</b></label>
<input id="password" type="password" placeholder="Password" required/><br/>
<input class="button" type="submit" value="Login" /><br/>
</form>
</main>
</div>Run Code Online (Sandbox Code Playgroud)
我有以下 C - 程序:
#include <stdio.h>
#include <time.h>
int main(int argc, char *argv[]){
srand(time(NULL));
printf("%d", rand());
}
Run Code Online (Sandbox Code Playgroud)
这个 Python 脚本:
import random
import time
random.seed(int(time.time()))
print (random.randint(0, 2147483647))
Run Code Online (Sandbox Code Playgroud)
C 程序中的 RAND_MAX 定义为 2147483647。如果我在同一秒启动两个程序,它们应该打印相同的“随机”数,但事实并非如此?
任何想法为什么?是否实现了不同的方法来获取伪随机数?种子肯定是一样的。