,我將不勝感激,如果有人能幫助我找到怎樣解決了一個問題,可能是我需要很簡單的事情,但我不知道如何把它放在一個,還等什麼我需要 - 部分包括複選框,然後按鈕提交,但如果您不勾選複選框,並按下出現的窗口,其中說,你必須做....,勾選複選框,然後提交,然後彈出窗口
我已經做到了,但我需要這個
,但如果你打勾和按鈕應該順利出現彈出窗口只是文本信息!我不知道怎麼去說, 這是複選框,按鈕
<form name="form" method="post" action="#" onSubmit="return checkme();">
<input type="checkbox" name="agree" value="agree_terms" class="terms">
I´ve read terms and conditions and I´m ready to shop
<input type="submit" name="submit" value="" class="submit">
</form>
這就是部分,這是JavaScript的
function checkme() {
missinginfo = "";
if (!document.form.agree.checked) {
missinginfo += "You must agree to the Terms and Conditions";
}
if (missinginfo != "") {
missinginfo ="" +
"\n" +
missinginfo + "" +
"\n Please tick the box and try again.";
alert(missinginfo);
return false;
}
else {
return true;
}
}
我在不同的方式試圖
<body>
<title>LIGHTBOX EXAMPLE</title>
<style>
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height: 50%;
padding: 16px;
border: 16px solid orange;
background-color: white;
z-index:1002;
overflow: auto;
}
</style>
</head>
<body>
<p>This is the main content. To display a lightbox click <a href = "javascript:void(0)"
onclick = "document.getElementById('light').style.display='block'; document.getElementById('fade').style.display='block'">here</a></p>
<div id="light" class="white_content">This is the lightbox content. <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none'; document.getElementById('fade').style.display='none'">Close</a></div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
但當我勾選與背景出現窗口背景上的複選框,但我需要彈出窗口時出現只有當我勾選框並按下按鈕
雖然我明白你想要什麼。你在這裏沒有給我們太多。你能否至少向我們展示你現在擁有的HTML代碼? – Codeguy007
請參閱上面的編碼:) –
'missinginfo + =「您必須同意條款和條件」;'僅用於觸發發送(如果存在)。應該'missinginfo =「」'是'missinginfo + =「」'?無論如何,這是多餘的。我不知道你有兩個如果陳述,當你會做。你有更多的代碼?也''='應該''==' – Codeguy007