By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

text:wrap not working when created dynamically

P: n/a
I have a script that is not rendering the textwrap in svg properly.
//does not work .....
var svgLand = svgObj.getElementById("NarrDisplay");
mytextwrap=
document.createElement("text:wrap"); mytextwrap.setAttribute("x","20");
mytextwrap.setAttribute("y","30");
mytextwrap.setAttribute("width","640");
mytextwrap.setAttribute("style","fill:#000000; font-family:arial;
font-size:14; text-align:left; line-interval:1.25em;");
mytext=document.createTextNode("something here");
mytextwrap.appendChild(mytext);
svgLand.appendChild(mytextwrap);
//works ....
mynorm_text = document.createElement("text");
mynorm_text.setAttribute("x","30");
mynorm_text.setAttribute("y","90");
mynorm_text.setAttribute("style","fill:#000000; font-family:arial;
font-size:14; text-align:left;");
mytext=document.createTextNode("something here");
mynorm_text.appendChild(mytext);
svgLand.appendChild(mynorm_text);

It works when I use this statically:
<text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#000000;
font-family:arial; font-size:14; text-align:left;
line-interval:1.25em;">default text</text:wrap>

Any help appreciated.

Mike

Jul 24 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
mike said the following on 7/24/2005 11:20 AM:
I have a script that is not rendering the textwrap in svg properly.
//does not work .....
var svgLand = svgObj.getElementById("NarrDisplay");
mytextwrap=
document.createElement("text:wrap"); mytextwrap.setAttribute("x","20");

mytextwrap.x = "20";
mytextwrap.setAttribute("y","30");


mytextwrap.y = "30";

And so on. Meaning, don't use setAttribute, just set the properties
directly.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 24 '05 #2

P: n/a
No change ........ same thing...... does not work.

Jul 24 '05 #3

P: n/a
I got it. textwrap.es has some functions with the object.

So after i created the static textwrap instance:

<text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#000000;

font-family:arial; font-size:14; text-align:left;
line-interval:1.25em;">default text</text:wrap>

I can use:
var text = TextWrap._instances[0];
text.setString(task_text);

and it will change the text.

see textwrap.es

Mike

Jul 24 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.