Javascript 无法在引导通知插件上使用HTML内容
我正在尝试使用引导通知插件来显示通知。可在以下网址找到。但是,我无法根据指定内容使用html选项。如果我打开HTML选项,通知将不显示任何消息。谢谢你的帮助,谢谢 下面是显示消息的函数(在指定时间,它可以正常工作,但只与文本一起工作) 实际的插件可以在这里找到,它正在工作: 我将html属性设置为message1Javascript 无法在引导通知插件上使用HTML内容,javascript,twitter-bootstrap,Javascript,Twitter Bootstrap,我正在尝试使用引导通知插件来显示通知。可在以下网址找到。但是,我无法根据指定内容使用html选项。如果我打开HTML选项,通知将不显示任何消息。谢谢你的帮助,谢谢 下面是显示消息的函数(在指定时间,它可以正常工作,但只与文本一起工作) 实际的插件可以在这里找到,它正在工作: 我将html属性设置为message1 函数notifyMessage(位置、消息输入、日期、毫米、yyyy、hh、mn){ //将时间戳添加到消息中 var message1='' +'预定-' +信息素 +“”; /
函数notifyMessage(位置、消息输入、日期、毫米、yyyy、hh、mn){
//将时间戳添加到消息中
var message1=''
+'预定-'
+信息素
+“”;
//硬编码blackgloss类型,如果需要,可以将其设置为参数
变量类型='blackgloss';
var now=新日期();
var millisttime=新日期(yyyy,mm-1,dd,hh,mn,00,0)-现在;//ms到指定的时间
//如果其值小于0,则将millisTillTime设置为0(以显示过期的未显示消息)
如果(毫秒时间<0)毫秒时间=0;
setTimeout(函数(){
$('.+position).notify({message:{html:message1},type:type,fadeOut:{enabled:false}).show();
},毫秒时间);
}
notifyMessage(“测试”,“你好”,3,2,2014,11,53);
向我们展示您迄今为止所做的工作,我们无法为您提供其他帮助。我已按要求添加了代码Hanks Lalit@idefine,我只是在您发布之前5秒,阅读示例和notify.js文件(第41,42行)。再次感谢你的帮助。
function notifyMessage(position, messageIn, dd,mm,yyyy,hh,mn)
{
//add the timestamp to the message
// var message1 = '<html>Scheduled - '+dd+'/'+mm+'/'+yyyy+' '+hh+':'+mn+'<br>'+ message + '</html>';
var message1 = '<html>Scheduled - '+ messageIn + '</html>';
alert (message1.html());
//hardcoded blackgloss type, this can be made a parameter if required
var type = 'blackgloss';
var now = new Date();
var millisTillTime = new Date(yyyy, mm-1, dd, hh, mn, 00, 0) - now; //ms till the specified time
//set millisTillTime to 0 incase its value < 0 (to display expired undisplayed messages)
if(millisTillTime < 0)
{
millisTillTime = 0;
}
setTimeout(function()
{
$('.' + position).notify({ message: { text: message1}, type: type, fadeOut: {enabled: false}}).show();
}, millisTillTime);
}
<!-- Le styles -->
<link href="css/prettify.css" rel="stylesheet">
<link href="../../css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- Notify CSS -->
<link href="css/bootstrap-notify.css" rel="stylesheet">
<!-- Custom Styles -->
<link href="css/styles/alert-bangtidy.css" rel="stylesheet">
<link href="css/styles/alert-blackgloss.css" rel="stylesheet">
</head>
<body>
<div class='notifications top-right'></div>
<div class='notifications bottom-right'></div>
<div class='notifications top-left'></div>
<div class='notifications bottom-left'></div>
<script src="../../javascripts/jquery-1.8.3.js"></script>
<script src="js/prettify.js"></script>
<script src="js/bootstrap-transition.js"></script>
<script src="js/bootstrap-alert.js"></script>
<script src="js/bootstrap-notify.js"></script>
<? include 'notify.php';?>
</body>