I have a program in which calling a script function in dblclick of a tr.Also Passing some arguments which is generated dynamically

Part of my markup is

<tr id="#ID#_#VERSION_ID#" ondblclick="ShowAssetPreviewPopup(#PreviewPath#, #UUID#, #GENERAL_VIRTUAL_PATH#)"

The preview path will be replaced by something like this 'http://example.somethingsomething.mp4' and in the same way other 2 parameteres too. Up to here every thing is ok and as I click that tr the following function will get evoked

function ShowAssetPreviewPopup(PreviewPath, UUID, LowresVirtualpath) {   
            $("#divPreviewPopUp").find("#divVideoPreview").html("example");
            $("#divPreviewPopUp").css({"display:block"});
            $("#divPreviewPopUp").css({ "top": (($(window).height() / 2) - ($("#divPreviewPopUp").height() / 2)) });
            $("#divPreviewPopUp").css({ "left": (($(window).width() / 2) - ($("#divPreviewPopUp").width() / 2)) });
}

But an error is occurring in Firebug

enter image description here

What would be the reason and how to solve this?

有帮助吗?

解决方案 2

I assume #PreviewPath# is a string variable from your template engine. You have to surround these string variables by single quotes.

<tr id="#ID#_#VERSION_ID#" ondblclick="ShowAssetPreviewPopup('#PreviewPath#', #UUID#, '#GENERAL_VIRTUAL_PATH#')">

其他提示

Try to change:

$("#divPreviewPopUp").css("display:block");

to:

$("#divPreviewPopUp").css("display", "block");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top