English 中文(简体)
我如何在特殊学校道路的形成中使用一个变量?
原标题:How can I use a variable within an SVG path creation?
  • 时间:2010-06-22 14:52:31
  •  标签:
  • html
  • svg

I m 采用Raphael图书馆和以下代码,开辟特别学校道路:

this.resultsBoxLine1 = paper.path("M42 10L42 36");

我愿利用变量来决定道路的位置,但我不能这样说:

this.resultsBoxLine1 = paper.path("MmyVar11 myVar2LmyVar3 myVar4");

没有人知道我如何能够这样做?

最佳回答

Raphael途径只是一种扼杀性——你可以轻易使用<代码>+的操作者,例如:

this.resultsBoxLine1 = paper.path("M"+myVar11+" "+myVar2+"L"+myVar3+" "+myVar4);
问题回答

或者

this.resultsBoxLine1 = paper.path("M{0} {1}L{2} {3}", myVar11, myVar2, myVar3, myVar4);

What about paper.path("M" + myVar11 + " " + myVar2 + "L" + ...);

Just use Java string concats





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签