Solved

SVG-Scripting errors in IE9

Posted on 2011-03-25
6
1,363 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
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:iGottZ
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Cut_OS
Comment Utility
@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
Comment Utility
Happy to help.
Please accept and rate my solution.
Thank you.
0
 

Author Comment

by:Cut_OS
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now