Arvin
Arvin

Reputation: 1014

Error while passing url as parameter in javascript

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?

Upvotes: 0

Views: 79

Answers (2)

Capitaine
Capitaine

Reputation: 2005

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#')">

Upvotes: 1

Felix
Felix

Reputation: 38112

Try to change:

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

to:

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

Upvotes: 2

Related Questions