Javascript";“如果和其他”;声明
我有一个Javascript";“如果和其他”;声明,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个服务条款页面,我想强制用户在单击接受按钮之前选中复选框。否则,它将显示一条弹出消息,说明 继续之前,请阅读ToS 如果选中并单击“接受”按钮,他们将重定向到官方网站 有人能帮我吗?试试这个: <SCRIPT> //Accept terms & conditions script (by InsightEye www.insighteye.com) //Visit JavaScript Kit (http://javascriptkit.com) for this s
服务条款
页面,我想强制用户在单击接受按钮之前选中复选框
。否则,它将显示一条弹出消息,说明
继续之前,请阅读ToS
如果选中并单击“接受”按钮,他们将重定向到官方网站
有人能帮我吗?试试这个:
<SCRIPT>
//Accept terms & conditions script (by InsightEye www.insighteye.com)
//Visit JavaScript Kit (http://javascriptkit.com) for this script & more.
function checkCheckBox(f) {
if (f.agree.checked == false ) {
alert('Please check the box to continue.');
return false;
} else {
return true;
}
}
</SCRIPT>
<form action="/yourscript.cgi-or-your-page.html" method="GET"
onsubmit="return checkCheckBox(this)">
<!--Enter your form contents here-->
<b>By submitting, I agree that all info entered was done
accurately & truthfully.</b><br>
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Submit form">
<input type="button" value="Exit" onclick="document.location.href='/index.html';">
</form>
//接受条款和条件脚本(由InsightEye www.InsightEye.com提供)
//访问JavaScript工具包(http://javascriptkit.com)对于这个脚本&更多。
函数复选框(f){
如果(f.agree.checked==false){
警报('请勾选此框以继续');
返回false;
}否则{
返回true;
}
}
通过提交,我同意所有输入的信息都已完成
准确、真实。
我接受:
或者这个:
<form name="frm">
<input type="checkbox" name="chk" onClick="apply()">If you click this the specified
url will open.
<div align=center>©<a href="http://www.mine.com" style="color:#3D366F;text-decoration:none;cursor:pointer;font-size=13px">hscripts.com</a></div>
</form>
<script type="text/javascript">
function apply() {
if(document.frm.chk.checked==true) {
window.open("http://www.mine.com/license/license.html");
}
}
</script>
如果单击此按钮,则指定
url将打开。
&抄袭
函数apply(){
if(document.frm.chk.checked==true){
窗口打开(“http://www.mine.com/license/license.html");
}
}
在提交处理程序
中检查此条件
if (formname.checkboxname.checked == true)
{
//showalert
return false;
}else{
//open your page
}
你做了什么?有什么需要帮忙的吗?我们需要看看你有什么,到目前为止你不需要JavaScript(除非你关心较旧的浏览器)
这正是我想要的,谢谢!这些都不是特别“安全”的。在第一种情况下,如果禁用javascript,表单将提交,因此必须在服务器上进行检查,以确定是否选中了复选框。在第二种情况下,用户只需复制href即可进入页面。在这两种情况下,一旦用户访问了链接,如何阻止他们以后直接访问URL?如果您有solution.plz提供。这更容易理解thankscheers:)如果您觉得有用,请标记为答案。