每次用户注册我们的网站时,我们都需要显示NDA(保密协议).为了继续,用户必须接受它.我的问题是我在所有页面中都有NDA,用户并没有真正阅读并接受(就像我们所做的那样).
我想要的是确保用户阅读NDA并接受它"阅读"它?
我现在拥有的是一个简单的jQuery验证,如果用户选中一个框并单击"接受".然后它进入下一页.
这就是我所拥有的
<script>
$(document).ready(function() {
$('#go').click(function() {
// check if checkbox is check and go to next page
// i have this code
});
});
</script>
<div>
full nda
<hr>
<input type=checkbox> <input type=button value=go id=go>
</div>
Run Code Online (Sandbox Code Playgroud)
我已经有了复选框和按钮的代码
我只是不希望用户盲目接受nda
谢谢
Boo*_*eus 10
如果您想阻止用户找到"我同意的复选框"并按正确方式提交按钮,则必须隐藏它,然后在阅读完最后一页后显示这些输入.
这是您可以使用的示例脚本.这会在您滚动页面时加载术语,在最后一个时,它会添加一个复选框和提交按钮.
确保页面足够长,因此您必须滚动并使用.live事件(因为加载页面时复选框和输入按钮不存在)
// main page
<script>
function getTC() {
var id = $(".paragraph:last").attr("id").replace('tnc', '');
if((parseInt(id) + 1) > 10) {
return;
}
$.post("terms.php?paragraph=" + id, function(r) {
$('#terms').append(r);
});
}
$(document).ready(function() {
$(window).scroll(function(){
if($(window).scrollTop() == $(document).height() - $(window).height()) {
getTC();
}
});
// logic for checkbox & submit using .live
});
</script>
<div id="terms">
<div class="paragraph" id="tnc1">
Lorem ipsum dolor sit amet ...
</div>
<div class="paragraph" id="tnc2">
Lorem ipsum dolor sit amet ...
</div>
<div class="paragraph" id="tnc3">
Lorem ipsum dolor sit amet ...
</div>
<div class="paragraph" id="tnc4">
Lorem ipsum dolor sit amet ...
</div>
</div>
// php
<?php
// add security here
if(!isset($_GET['paragraph'])) {
$_GET['paragraph'] = '1';
}
$_GET['paragraph'] = (int)$_GET['paragraph'] + 1;
if($_GET['paragraph'] <= 10) {
?>
<div class="paragraph" id="tnc<?php echo $_GET['paragraph'] ;?>">
Lorem ipsum dolor sit amet ...
</div>
<?php
if($_GET['paragraph'] == 10) {
echo '<hr/>I agree with the terms and conditions <input type="checkbox" /><input type="button" value="I accept" /><hr/>';
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2330 次 |
| 最近记录: |