小编Ste*_*ish的帖子

如果输入有效,请更改按钮颜色

如果输入有效(填写必填字段),我想更改按钮的颜色.如果没有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)

html css forms validation

2
推荐指数
1
解决办法
1062
查看次数

Python - randomint() 应该等于 C - rand()

我有以下 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。如果我在同一秒启动两个程序,它们应该打印相同的“随机”数,但事实并非如此?

任何想法为什么?是否实现了不同的方法来获取伪随机数?种子肯定是一样的。

c python random

0
推荐指数
1
解决办法
3633
查看次数

标签 统计

c ×1

css ×1

forms ×1

html ×1

python ×1

random ×1

validation ×1