jQnotice消息中的链接

Link in the message of jQnotice

本文关键字:链接 消息 jQnotice      更新时间:2023-09-26

如何在以下脚本中创建工作链接?我用它作为一个弹出式窗口,在商店里购买商品:

$(document).ready(function() {
    $('a.buy').click(function() {
        jQnotice('Message..! - here i want to ad a url ex. "link go to shop" ');
    });
});

在JQnotice插件中这一行

$('<div></div>').attr('id', 'notice').css('left', (50-left)+'%').css('top', (0+top)+'px').appendTo('body').text(message);

应该是这样的

$('<div></div>').attr('id', 'notice').css('left', (50-left)+'%').css('top', (0+top)+'px').appendTo('body').html(message);

链接

http://jsbin.com/iwedah

链接应为:

  <a class='buy'>click me</a>

既然你选择的链接是class = buy.

HTML:

<a href="http://example.com" class="buy">Link</a>

JS:

$(document).ready(function() {
    $('a.buy').click(function() {
        jQnotice('Message..!<a href="' + $(this).attr('href') + '">Go to shop</a>');
        return false;
    });
});