Javascript 检查确认ok后如何淡入div on

Javascript 检查确认ok后如何淡入div on,javascript,jquery,Javascript,Jquery,JS HTML 你好 我只想在弹出框中打开此框,单击“确认”框中的“确定”,然后单击“取消”按钮上的“页面刷新”该函数,CheckFedderalTimeStatus(),在全局范围内不可用 以下是修改后的代码: JS window.CheckFedderalTimeStatus=函数(){ var answer=confirm('联邦法律限制在晚上9点之间发送手机短信 收件人当地时间上午8点。如果您认为您的邮件的性质 不属于此限制(例如紧急警报),请单击“确定”申请紧急警报 例外情况。”

JS

HTML


你好

我只想在弹出框中打开此框,单击“确认”框中的“确定”,然后单击“取消”按钮上的“页面刷新”

该函数,
CheckFedderalTimeStatus()
,在全局范围内不可用

以下是修改后的代码:

JS


window.CheckFedderalTimeStatus=函数(){
var answer=confirm('联邦法律限制在晚上9点之间发送手机短信
收件人当地时间上午8点。如果您认为您的邮件的性质
不属于此限制(例如紧急警报),请单击“确定”申请紧急警报
例外情况。”);
若有(答复){
$(“#inline2”)。法代因(300);
美元(“.overlay fixed”).fadeIn(300);
$(“.fancybox已打开”).fadeIn(300);
返回false;
}
否则{
location.reload();//重新加载页面
//window.location=“sendmsg.php”;
返回false;
}
}

这里是演示:

我想如果你想保持当前页面的状态,那么你可以从
的else
部分简单地
返回false

<script>
 window.CheckFedderalTimeStatus = function(){
      var answer = confirm('Federal law restricts sending of mobile text messages between 9PM
and 8AM of recipient`s local time. If you believe that the nature of your message does
not fall under this restriction (e.g. emergency alert), please click OK to apply for an
exception.');

if(answer){
   $("#inline2").fadeIn(300);
   $(".overlay-fixed").fadeIn(300);
   $(".fancybox-opened").fadeIn(300);
   return false;
}
else {
  location.reload(); // reload the page
  //window.location = "sendmsg.php";
  return false;
 }
}
</script>

对于
if
部分,我能理解的是您希望在弹出框中显示“#inline2”元素。我想这就是您想要的?

请澄清您的需求,您想在弹出框中打开此框是什么意思?@VaibhavKatole我想在弹出框中打开此框单击“取消”按钮时是否要重新加载当前页面?您的函数名中是否有明显的打字错误('Fedderal'而不是,正确的,'Federal'))故意?你的小提琴显示出控制台错误。”未捕获引用错误:未定义CheckFedderalTimeStatus“请检查”。@VaibhavKatole:哦,我没有看到从多个浏览器检查该错误。检查这个
<a href="#" onclick="CheckFedderalTimeStatus()">fade In </a>
<div id="inline2" style="width:650px;display: none; font-size:14px; overflow:scroll"> hello </div>
<script>
 window.CheckFedderalTimeStatus = function(){
      var answer = confirm('Federal law restricts sending of mobile text messages between 9PM
and 8AM of recipient`s local time. If you believe that the nature of your message does
not fall under this restriction (e.g. emergency alert), please click OK to apply for an
exception.');

if(answer){
   $("#inline2").fadeIn(300);
   $(".overlay-fixed").fadeIn(300);
   $(".fancybox-opened").fadeIn(300);
   return false;
}
else {
  location.reload(); // reload the page
  //window.location = "sendmsg.php";
  return false;
 }
}
</script>
else {
    location.reload(); // use this if you want to reload page anyway.
    return false;
}