我需要从我的HTML代码中创建一个.cgi Bash脚本

时间:2017-05-01 14:35:52

标签: javascript jquery html bash

如果您点击“注册”部分,它应该切换并切换表格。(这对我不起作用)
我需要为它编写一个Bash .cgi脚本 我不确定是否应将我的表单元素放在我的.cgi中或将其保存在.HTML文件中。

HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>

<script type="text/javascript" src="This PC/Downloads/jquery-3.2.1.js"> 
</script>

<style>
    body{background-color:black;margin: 0px; padding: 0px; max-width:890px;}

    h2 {color:white; text-align: center}

    h3 { font-size: 15px; vertical-align: middle; text-align: center }

    .homeDiv { max-width: 890px; position: relative; left:220px; right: 
       220px; font-size: 30px; background-color: gray; }

    .InstructorDiv { cursor: pointer;position:absolute; top: 
       100px;left:220px; height:40px; width:200px; background-color:pink; 
       color:black; }

    .StudentDiv { cursor:pointer;position:absolute; top: 100px; left:570px;  
      height:40px; width:200px; background-color:pink; color:black; }

    .Register {  cursor:pointer;position: absolute; top:100px; left:910px;  
      height:40px; width:200px; background-color:pink; color:black; }

    .form { display: none; height: auto; width: 200px;}

</style>

</head>

<body>

 <div class="homeDiv"><h2>Home</h2></div>

 <div class="InstructorDiv"><h3>Instructor login</h3></div>
 <div class="StudentDiv"><h3>Student login</h3></div>
 <div class="Register"><h3>Register</h3></div>

 <div class="form">
  <form>
   <input type="text" name="name" /><br>
   <input type="password" name="password" /><br>
   <input type="submit" value="Submit" /><br>
  </form>
 </div>

 <script>
   $(document).ready(function(){
     $(".Register").click(function(){
       $(".form").slideToggle(400);
     });
   });
   function() {
    $(".form").slideToggle(400);
   });
 </script>

</body>
</html>

Home.cgi

#! /bin/bash
echo "Content-type: text/html"
echo ""

if [ -n ${QUERT_STRING} ]; then
OLD_IFS=$IFS
IFS="=&"
parm=($QUERY_STRING)
IFS=$OLD_IFS

cat << EOF
<!DOCTYPE html>
<html>
<head>
 <title>Login</title>
</head>
<body>
 <h1>Sign in here:</h1>
<form>
EOF
 <label><b>Username</b></label>
 <input type="text" placeholder="Enter Username" name="uname" required>
 <label><b>Password</b></label>
 <input type="password" placeholder="Enter Password" name="psw" required>
  <button name= "click" type="submit" value="Submit">Login</button>
cat << EOF
</form>
</body>
</html>

0 个答案:

没有答案