Hi, David-

ddailey wrote:
| 
| I know that asking two questions at once can be a problem, 
| but these are only two and they are related:

Don't take this personally, but as you note, asking one question at a time
is more practical for several reasons:

1) It makes for shorter emails that are easier to understand;
2) If someone knows the answer to one question, but not the other, they are
less likely to respond;
3) If you have made wrong assumptions about the nature of the problem, it is
easier to extricate each issue separately (the questions might not be
related after all);
4) If one question (or worse yet, both) leads to a longer thread, it gets
really confusing;
5) If someone answers only one question, others who only skim the list might
see that the email has been answered, and be less likely to follow up on it;
6) It takes less time to answer single-question emails (personally, I recall
specifically that I started replying to one of your emails that had about 6
questions, and answered 2 of them, then my mind wandered off to greener
fields and I never sent the email at all);
7) When others have a similar question and try to find it in the archives,
longer threads and jumbled subjects make it much harder to find, or to
understand if they are newbies;
8) More than one question leads to unhelpful subject lines, which make it
harder to search for, decreases the contextualization of the problem, and
decreases the likelihood that someone will look at the subject and say, "oh,
I know how to fix that", thus decreasing your changes to be answered (I
personally rarely answer emails with subjects like "HELP!!! How do you make
SVG work?!");
9) It sets pedantic jerks like me off on long tirades before they answer
your question.


| I wish to allow the user to select which of multiple SVG 
| files might become the src of an embed in HTML.
| 
| The following works okay in IE/ASV but not in Firefox or Opera 9 and 
| question 1 is
| 
| 1. How do I get it to work across browsers?

If seems like you're creating the div and emed again and again. Why not just
change the src attribute of the existing embed? This will be faster anyway,
and works across browsers. Also, change the src with "blah.src = 'buh.svg'"
instead of setAttribute.

function ChangeImage( imageName )
{
   var svgEmbed = document.getElementById( 'svgEmbedId' );
   svgEmbed.src = imageName + '.svg';
}


| 2. How do I know that the SVG document has loaded, so that I 
| don't have to put an alert()
| between the building of the "embed" and the attempted read of the SVG 
| document? IE fusses if I don't pause between the two.

There are a number of ways around this. Just to clarify the problem, it's
not an arbitrary pause; the script has to wait for the SVG to be read into
the DOM and rendered. On dial-up, for example, this can sometimes take a
while, so you are better off planning for it.

If the SVG you are loading has a script in it, you can have make a call from
the SVG to the HTML, signalling that it is loaded and ready. Have it
triggered from the 'load' event. This is pretty efficient, I've found,
especially for large SVGs. For very large external scripts, place the script
reference at the end of your SVG document and the Init function at the very
end of your script block, so that it is the last thing loaded; that way, you
can be sure all resources are loaded.

If the SVG does not contain script, you can simply insert a timeout before
you make your next call (rather than an alert). I will sometimes use a
recursive function that checks for the presence of the SVG, and if it's not
there, calls itself with a setTimeout; if you do this, give it a global loop
counter of, say, 5 or 10 times, just in case the resource is never loaded,
so you don't get into an infinite loop.

There are probably other ways to deal with this, but the ways I listed work
well for me.


Regards-
Doug



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to