Mootools在事件点击功能中添加href url

时间:2011-10-26 16:11:40

标签: javascript mootools

我有一个脚本,我试图在事件点击功能中添加一个HREF网址:::当点击一个按钮时,脚本应该启动MilkBox(灯箱):::我的Javascript非常有限但是我可以在标题属性中添加“HREF url”,如下所示(测试),因为我在下面它有效,但是当我将'+ fullurl +'移动到HREF时它失败了。然后它无法加载网址:::灯箱以空URL :::

启动
$("wall").addEvents({

    "mouseover:relay(div.tile)": function() {
        var play = this.retrieve("play");
        if (!play) {
            play = new Element("div", {
                styles: {
                    position: "absolute",
                    marginTop: 120,
                    marginLeft: 120,
                    width: 32,
                    height: 32
                },
                "title": "Click to play",
                "class": "cur hide",
                    events: {
                        click: function() {
                            var tubeObject = this.getParent().retrieve("tubeObject");
                            var tubeObject = this.getParent().retrieve("tubeObject")
                            var fullurl = tubeObject.full;

                                milkbox.openWithFile({ 
                                    href:'http://localhost/square/wp-content/uploads/2011/10/34.jpg', 
                                    title:''+fullurl+''
                                });
                        }
                    },
                html: "<img src='http://cdn1.iconfinder.com/data/icons/CornerStone/PNG/play.png' />"
            }).inject(this, "top");
            this.store("play", play);
        }
        play.removeClass("hide");
    },
    "mouseout:relay(div.tile)": function() {
        this.retrieve("play").addClass("hide");
    }

});

1 个答案:

答案 0 :(得分:0)

我能够解决问题:::我的(自定义)TimThumb函数导致它无法正常工作:::脚本工作的底线:::