如何使用模态使我的警报保持更好的外观? [英] How to leave my alert with better looking using modal?
问题描述
我有一个JavaScript警报,可以通过单击#menu2返回警报来完美地实现我想要的功能,但是我想更改警报的视觉部分,使其在Chrome浏览器中可以正常工作.为此,我尝试了几次使用jQuery,Bootbox等.因此,我在这里尝试了更好的编程,以使脚本更加人性化.
I have a JavaScript alert that is working perfectly for what I want it to do by returning an alert by clicking on # menu2, however I want to change the visual part of the alert to work perfectly in the Chrome browser. For this I tried several times the use of jQuery, Bootbox among others. So I've tried a better programming here to make my script more user-friendly.
我尝试使用,但对我无济于事.
上一个问题的其他选项:
这是我的html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<ul id='menu'>
<li id='menu1'><a href='/web/front/helpdesk.public.php' title="Home" class='itemP'>Home</a>
</li>
<li id='menu2'><a href='/web/front/helpdesk.public.php' title="Cria um chamado" class='itemP'>Cria um chamado</a>
</li>
<li id='menu3'><a href='/web/front/ticket.php' title="Chamados" class='itemP'>Chamados</a>
</li>
<li id='menu4'><a href='/web/front/reservationitem.php' title="Reservas" class='itemP'>Reservas</a>
</li>
<li id='menu5'><a href='/web/front/helpdesk.faq.php' title="FAQ" class='itemP'>FAQ</a>
</li>
</ul>
这是我的JavaScript
"<script type='text/javascript'>
$(document).ready(function(){
$('#menu2').click(function(event){
event.preventDefault();
alert('Text');
})
});
</script>";
我在Chrome上的提醒
我试图更改警报的视觉部分的方法.
"<script type='text/javascript'>
$(document).ready(function () {
$('#menu2').dialog({
e.preventDefault();
});
$('#menu2').click(function () {
});
});
</script>";
我无法在我的php代码中编写此处描述的示例.因此,我将代码的一部分发布到可以运行脚本的位置.我要求您将代码用于此处描述的解决方案,以加深我的理解.
if (Session::haveRight("ticket", CREATE)) {
$menu['create_ticket']['id']= "menu2";
/*My alert of menu2*/
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#menu2').click(function(event){
event.preventDefault();
alert('Text');
})
});
</script>";
$menu['create_ticket']['default'] = '/front/helpdesk.public.php?create_ticket=1';
$menu['create_ticket']['title'] = __s('Create a ticket');
$menu['create_ticket']['content'] = array(true);
}
Obs:我正在将脚本发布给PHP应用程序.
Obs: I am issuing the script to a PHP application.
我希望有人可以帮助我..
I hope someone can help me ..
我可以使用sweetalert对警报进行编程,以使其具有更好的外观.现在,我需要为#menu调用onClick函数.但是我无法前进.
I can program the alert for a better look by using the sweetalert. Now I need to call the onClick function for #menu. But I can not move forward.
我的新脚本
echo '<script type="text/javascript">';
echo 'setTimeout(function () { swal("Return the alert test !","Message!","success");';
echo '}, 1000);</script>';
我的新警报:
推荐答案
使用Sweet Alert Jquery插件进行高度自定义的警报
Use Sweet alert Jquery Plugin for highly customized alert
这篇关于如何使用模态使我的警报保持更好的外观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!