我的表单正在使用HTML和PHP。这是我第一次创建电子邮件表单,为此添加验证码的最佳方法是什么?在这个晚上好,先生,如果我可以问。我发给你我的问候和欢呼
HTML
<head>
<title>Kontakt - A.Willi A.G</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv= "content-type" content="text/html"; charset="UTF-8">
<meta name ="web_author" content="A.Willi A.G A.J.W">
<meta name="robots" content="noarchive">
<meta name="robots" content="selection">
<meta name="language" content="DE">
<meta name='pagename' content='Home, Rohrschlosser, Schweisser, Jobs, Personalverleih, Basel, Schweiz.'>
<meta name="copyright" content="Copyright at A.Willi A.G Personalverleih, Rohrschlosser, Schweisser, Basel.">
<meta name ="description" content=
"Die A.Willi A.G ist als Personalverleiher in der gesamten Schweiz und im Ausland erfolgreich
tatig mit über 30-jahrige Erfahrung in dieser Sparte.<<Wir suchen immer neue
Montagepersonel; Rohrschlosser, Schweisser und Monteur>><<Basel, Jobs, Welder,
Pipefitter, Mntage, Arbeitsmarkt, Temporär>>">
<link rel="shortcut icon" href="aw.png">
<link rel="stylesheet" href="style.css" type="text/css"/>
<script src="html5shiv.js"></script>
</head>
<script>
function _(id){ return document.getElementById(id); }
function submitForm(){
_("mybtn").disabled = true;
_("status").innerHTML = 'please wait ...';
var formdata = new FormData();
formdata.append( "n", _("n").value );
formdata.append( "e", _("e").value );
formdata.append( "m", _("m").value );
var ajax = new XMLHttpRequest();
ajax.open( "POST", "example_parser.php" );
ajax.onreadystatechange = function() {
if(ajax.readyState == 4 && ajax.status == 200) {
if(ajax.responseText == "success"){
_("my_form").innerHTML = '<h2>Thanks '+_("n").value+', your message has been sent.</h2>';
} else {
_("status").innerHTML = ajax.responseText;
_("mybtn").disabled = false;
}
}
}
ajax.send( formdata );
}
</script>
<body>
<div class="container">
<div class="logo">
<h1 align="center"><img src="logo2.png" height="110" width="500" alt="A.Willi A.G" /</h1>
</div>
<div class="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li class="dropdown">
<a href="" class="dropbtn">Bewerber</a>
<div class="dropdown-content">
<a href="info.html">Info</a>
<a href="jobs.html">Jobs</a>
</div>
</li>
<li class="dropdown">
<a href="#" class="dropbtn">Kunde</a>
<div class="dropdown-content">
<a href="personnel.html">Personalverleih</a>
<a href="rental.html">Werkzeuge Mieten</a>
<a href="refrences.html">Referenzen</a>
<a href="quali.html">Qulität, Sicherheit und Weiterbildung</a>
</ul>
</li>
</div>
<div class="slideshow">
<img src="panorama.jpg">
<img src="panorama.jpg">
<img src="panorama.jpg">
</div>
<h2 align="center"> <!--FORM-->
<form id="my_form" onsubmit="submitForm(); return false;">
<p><input style="font-size: 30px" id="n" placeholder="Vorname" required></p>
<p><input style="font-size: 30px" id="x" placeholder="Nachname" required></p>
<p><input style="font-size: 30px" id="z" placeholder="Telefon" required></p>
<p><input style="font-size: 30px" id="z" placeholder="Email Address" required></p>
<textarea style= "font-size: 30px" id="m" placeholder="write your message here" rows="10" required></textarea>
<p><input id="mybtn" type="submit" value="Submit Form"> <span id="status"></span></p>
</form>
</h2>
<footer class="footer-distributed"> <!--LEFT LOGO FOOT-->
<div class="footer-left">
<img src="awlogocolor.png" height="50" width="250" alt="A.Willi A.G" />
<p class="footer-links"> <!--LINKS-->
<a href="#">Home</a>·
<a href="#">Zertifikate</a>·
<a href="#">Datenschutz-Bestimmungen</a>·
<p class="footer-company-name">©2016 A.Willi A.G</p>
</div>
<div class="footer-center"> <!--CENTER-->
<div>
<i class="fa fa-map-marker"></i>
<p><span>Wasgenring 94</span> CH-4055 Basel</p>
</div>
<div>
<i class="fa fa-phone"></i>
<p><span>Fax +41 (0)61 856 14 38</span>
Tel. +41 (0)61 646 18 18<span>
info@awilliag.ch</span></p>
</div>
<div>
<i class="fa fa-envelope"></i>
</div>
</div>
<div class="footer-right"> <!--RIGHT-->
<div class="slideshow2">
<p><font color="white">Wir möchten uns bei alle unseren Kunden bedanken.</font></p>
<img src="lehman.png" height="50" width="50">
<img src="jc.png" height="50" width="50">
<img src="iwb.png" height="50" width="50">
</div>
</div>
</footer>
</body>
</div>
</html>
CSS
body{
font-family: verdana;
background:whitesmoke ;
color:black;
}
.menu {
background: black;
width:100%;
}
ul {
list-style-type: none;
margin: 0 auto;
display:table;
padding: 0;
z-index: 100;
overflow: hidden;
}
.logo {
height:
position: relative;
margin-bottom:-35px;
}
li {
float: left;
}
/* DROPDOWN Txt Color */
li a, .dropbtn {
display: inline-block;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* DROPDOWN Txt BOX Color */
li a:hover, .dropdown:hover .dropbtn {
background-color: #33383b;
}
li.dropdown {
display: inline-block;
}
/* DROPDOWN content clr */
.dropdown-content {
display: none;
position: absolute;
background-color: whitesmoke;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 100;
}
/* DROPDOWN TEXT CLR */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
/* DROPDOWN COL BOX */
.dropdown-content a:hover {
background-color: whitesmoke
}
.dropdown:hover .dropdown-content {
display: block;
}
@keyframes fade {
0% { opacity: 0; }
11.11% { opacity: 1; }
33.33% { opacity: 1; }
44.44% { opacity: 0; }
100% { opacity: 0; }
}
/* MENU COL */
.menu {
position: relative;
z-index: 0;
height: 2.9em;
margin-bottom: -0.4em;
margin-top: 0em;
z-index:1000;
background-color:#33383b;
}
/* slideshow header */
.slideshow {
position: relative;
z-index: ;
width: 100%;
top: 0;
box-sizing: border-box;
height: 250px;
max-width: 100%;
bottom: 20px;
}
.slideshow img{
margin:0 auto;
width: 100%;
max-height: 100%;
}
.slideshow img { position:absolute; left:0; right:0; opacity:0; animation-name: fade; animation-duration: 9s; animation-iteration-count: infinite; }
.slideshow img:nth-child(1) { animation-delay: 0s; }
.slideshow img:nth-child(2) { animation-delay: 3s; }
.slideshow img:nth-child(3) { animation-delay: 6s; }
/* slideshow2 header */
.slideshow2 {
position: relative;
z-index: ;
width: 150px;
top: 0em;
box-sizing: border-box;
height: 40px;
max-width: 100%;
bottom: 20px;
}
.slideshow2 img{
margin:0 auto;
width: 100%;
max-height: 100%;
}
.slideshow2 img { position:absolute; left:0; right:0; opacity:0; animation-name: fade; animation-duration: 9s; animation-iteration-count: infinite; }
.slideshow2 img:nth-child(1) { animation-delay: 0s; }
.slideshow2 img:nth-child(2) { animation-delay: 3s; }
.slideshow2 img:nth-child(3) { animation-delay: 6s; }
/* page container */
.container {
max-width: 100%;
margin-left: auto;
margin-right: auto;
}
/* article from jobs */
.article {
text-align: left;
height: 200px;
margin-bottom:11px
}
/* body of text */
textinfo {
width: 300px;
border: 25px solid green;
padding: 25px;
margin: 25px;
}
.footer-distributed{
background-color: #292c2f;
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.12);
box-sizing: border-box;
width: 100%;
text-align: left;
font: 15px verdana;
padding: 30px 30px;
margin-top: 100px;
}
.footer-distributed .footer-left,
.footer-distributed .footer-center,
.footer-distributed .footer-right{
display: inline-block;
vertical-align: top;
}
/* footer left */
.footer-distributed .footer-left{
width: 40%;
}
/* the company logo */
.footer-distributed h3{
color: #ffffff;
font: normal 15px 'Verdana', cursive;
margin: 0;
}
.footer-distributed h3 span{
color: #5383d3;
}
/* footer links */
.footer-distributed .footer-links{
color: #ffffff;
margin: 20px 0 12px;
padding: 0;
}
.footer-distributed .footer-links a{
display:inline-block;
line-height: 1.8;
text-decoration: none;
color: inherit;
}
.footer-distributed .footer-company-name{
color: #8f9296;
font-size: 15px;
font-weight: normal;
margin: 0;
}
/* footer center */
.footer-distributed .footer-center{
width: 35%;
}
.footer-distributed .footer-center i{
background-color: #33383b;
color: #ffffff;
font-size: 15px;
width: 38px;
height: 38px;
border-radius: 50%;
text-align: center;
line-height: 42px;
margin: 10px 15px;
vertical-align: middle;
}
.footer-distributed .footer-center i.fa-envelope{
font-size: 17px;
line-height: 38px;
}
.footer-distributed .footer-center p{
display: inline-block;
color: #ffffff;
vertical-align: middle;
margin:0;
}
.footer-distributed .footer-center p span{
display:block;
font-weight: normal;
font-size:14px;
line-height:2;
}
.footer-distributed .footer-center p a{
color: #5383d3;
text-decoration: none;;
}
/* footer right */
.footer-distributed .footer-right{
width: 20%;
}
.footer-distributed .footer-company-about{
line-height: 20px;
color: #92999f;
font-size: 15px;
font-weight: normal;
margin: 0;
}
.footer-distributed .footer-company-about span{
display: block;
color: #ffffff;
font-size: 15px;
font-weight: bold;
margin-bottom: 20px;
}
.footer-distributed .footer-icons{
margin-top: 25px;
}
.footer-distributed .footer-icons a{
display: inline-block;
width: 35px;
height: 35px;
cursor: pointer;
background-color: #33383b;
border-radius: 2px;
font-size: 15px;
color: #ffffff;
text-align: center;
line-height: 35px;
margin-right: 3px;
margin-bottom: 5px;
}
/* un responsive rmoval */
@media (max-width: 880px) {
.footer-distributed{
font: bold 14px sans-serif;
}
.footer-distributed .footer-left,
.footer-distributed .footer-center,
.footer-distributed .footer-right{
display: block;
width: 100%;
margin-bottom: 40px;
text-align: center;
}
.footer-distributed .footer-center i{
margin-left: 0;
}
logo {
margin-bottom:100px;
}
input {
font-size: 100px;
}
答案 0 :(得分:1)
将此代码段粘贴到HTML模板上的结束</head>
标记之前:
<script src='https://www.google.com/recaptcha/api.js'></script>
将此代码段粘贴到您希望显示reCAPTCHA小部件的位置的末尾:
<div class="g-recaptcha" data-sitekey="YOUR CAPTCHA KEY CODE"></div>