开发者

Simulate a url/href with click() and location create a error

I dynamical create a list with some elements which should be clickable. It's not a simple text but a table row so I wanted to use the click() feature.

This is the way I do it:

function PrepareServerItem(item, server)
{
    item.attr("id", "srv" + server.id);
    if (server.status == 0) item.click(function() { window.location = "cndr://" + server.url; });
    return item;
}

function CreateServerItem(server)
{
    return PrepareServerItem(serverItem.clone(true), server);
}

[....]
$("#someid").before(CreateServerItem(server));
开发者_运维问答

cdnr is a url protocol defined by a external program. This way works on chrome (still with a error -

"GET cndr://JCMCFCMCCCMFJSRDBBF undefined (undefined)"

but it opens the external program with the right parameter) but I got the following error within firefox:

uncaught exception: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: my internet address :: anonymous :: line 186" data: no]

Could it be that changing the location removes the current document and so also some stuff which the script needs? How can I solve the problem?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜