Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SVG-Scripting errors in IE9

Posted on 2011-03-25
6
Medium Priority
?
1,381 Views
Last Modified: 2012-06-22
Hi,
we have some trouble with the new IE9.
Our scripts are filled with methods like getSVGDocument() oder getStyle(), for example:

Node.item(i).getStyle().setProperty("visibility","hidden");
svgdoc = document.myName.getSVGDocument();

The Browser throw the error "unknown name" for this methods. Has anybody a workaround for this?

Thank you in advance.

Holger
0
Comment
Question by:Cut_OS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:iGottZ
ID: 35213913
posting an amount of 2 lines of code doesnt help us helping you.
in order to get serious help about this topic you should show us some more code.
0
 

Author Comment

by:Cut_OS
ID: 35214116
OK, another try:

function incrementGuillotineLevel(Obergrenze)
{
    UnHighlight_Streifen();
    ShowKlemmer(0,0);
    var Untergrenze = 1;
    var Value = document.forms["Interaktiv"].elements["Guillotine"].value;
    var svgdoc = document.Guillupanddown.getSVGDocument();
    var up = svgdoc.getElementById('upGuil');
    var down = svgdoc.getElementById('downGuil');
    if (Value > Obergrenze)
    {
        Value = Obergrenze;
        up.getStyle().setProperty('visibility', 'hidden');
    }
    if (Value < Untergrenze)
    {
        Value = Untergrenze;
        down.getStyle().setProperty('visibility', 'hidden');
    }
    else
    {
        if (Value != Obergrenze)
        {
            Value++;
            if (Value == Obergrenze)
            {
                up.getStyle().setProperty('visibility', 'hidden');
            }
            if (Value > Untergrenze)
            {
                down.getStyle().setProperty('visibility', 'show');
            }
        }
    }
    document.forms["Interaktiv"].elements["Guillotine"].value = Value;
    showPrimStripes(Value);

    var svgdoc2 = document.upanddown.getSVGDocument();
    var up2 = svgdoc2.getElementById('upZyklus');
    var down2 = svgdoc2.getElementById('downZyklus');
    down2.getStyle().setProperty('visibility', 'hidden');
    document.forms["Interaktiv"].elements["Zyklus"].value = 0;
    document.forms["Interaktiv"].elements["SubZyklus"].value = 0;
    if (MaxZyklus > 0)
    {
        up2.getStyle().setProperty('visibility', 'show');
    }
    else
    {
        up2.getStyle().setProperty('visibility', 'hidden');
    }
    return;
}

I'm using getSVGDocument() 44 times in the script-file, and getStyle() 93 times.
0
 
LVL 1

Accepted Solution

by:
BitBlitz earned 2000 total points
ID: 35407919
getSVGDocument only works in the IE9 document mode, and only on an embedded element.

E.g. what is the markup around upanddown?

instead of getStyle, try just .style.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Cut_OS
ID: 35431648
@BitBlitz
Thank your for your answer and solution!
I have found the entered IE7 document mode in the developer tool of the IE9 last week. Since then I'm using the meta-tag <meta http-equiv="X-UA-Compatible" content="IE=9" > (We will deliver the IE9 shared with our MFC software). So i can using getSVGDocument for the svg via object-tag now, when i define "application/xhtml+xml" as MIME-Type.
Other svg elements, like "upanddown", i have using now inline in the html document, so i can access direct via getElementByID("upanddown").

.style instead of getStyle is working perfectly.

The script is working with the IE9 now, but it was a hard time. I look forward to the new IE...
0
 
LVL 1

Expert Comment

by:BitBlitz
ID: 35431783
Happy to help.
Please accept and rate my solution.
Thank you.
0
 

Author Comment

by:Cut_OS
ID: 35433796
Now i have another problem...
When the embed svg-file is located on a network-drive, the IE9 is throwing many script-errors, like "access denied". Where is the one checkbox in the IE settings i have to click? :-(
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question