473,486 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

text:wrap not working when created dynamically

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
3 3379
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
No change ........ same thing...... does not work.

Jul 24 '05 #3
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1868
by: Nitesh Jain | last post by:
I want to write a simple utility, so that if I select a text, and press a hot key say (CTRL+ALT+G), then I should be able to open a google search page with the selected text. Could someone tell me...
0
1369
by: Mark Donners | last post by:
I have access 2002 database I like to fill a record field in a table with a text when i click a button I have two tables say table1 and table2. I have a form based on table1, it has a subform...
2
1588
by: Rich | last post by:
I accidentally toggled some key combination in my code module which is causing the code to text wrap. I meant to toggle ctrl-F. Is there a way to untoggle the text wrapt (wrap text)? Thanks,...
0
1237
by: abc my vclass | last post by:
which properties to focus automatic highlight text on text when on fous?
3
30074
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
3
2375
by: ASP Developer | last post by:
I have a variety of pages that use a master page. For some reason when I attempt to copy any of the label text on the screen it seems to highlight most of the screen randomly and I can't simply...
2
9227
by: zahirbar | last post by:
Hi, I have an image with a basically a big round circle (a photo). How do i make the text wrap around it fully? I use dreamweaver. Thanks
1
14154
by: maya | last post by:
hi, I have to do a page where there's a paragraph with an img on top left and the text in paragr has to wrap around the image.. pls see screen-shot here......
2
4755
by: imzac | last post by:
So, when I constructed the site, it really didn't bother me of the wasted space in these pages. However, I realize the error of my ways and have tried to change make the right div allow text wrap. ...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.