Solved

SVG-Scripting errors in IE9

Posted on 2011-03-25
6
1,380 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 500 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

617 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