开发者

Concatenate String

I have开发者_Python百科 the following javascript function:

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description',#{imagePath},'http://www.lala.com');
   }
</script>

The imagePath variable is populated with value: http://localhost/img/30_w130px.gif

I'm having the following script error: missing ) after argument list

publishContent('This is a description',http://localhost/img/30_w130px.gif,'http://www.lala.com');

How can i surround http://localhost/img/30_w130px.gif with quotes?

Thanks


Seems like you are in some kinds of template language..

Have you try quote at #{imagePath} ?

<script type="text/javascript">
function quickCardRegister_OnCompleteSave() {

  publishContent('This is a description','#{imagePath}','http://www.lala.com');
}
</script>


What about the missing '}' at the end for the function just before the closing script tag?

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description',#{imagePath},'http://www.lala.com');
   }
</script>


Try

publishContent('This is a description','"' + #{imagePath} + '"','http://www.lala.com');


You are missing } for your function as well as + for javascript concatenation:

<script type="text/javascript">
   function quickCardRegister_OnCompleteSave() {

      publishContent('This is a description' + #{imagePath} + 'http://www.lala.com');
   }
</script>

And I assume #{imagePath} something you would replace dynamically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜