0

In the following example the flash in my HTML would not show after moving it's parent element in DOM. I use appendChild on enclosing div of my object element to move it somewhere else in the DOM hierarchy, but after the move is complete the containing flash would not show.

I get this error in IE 10 and firefox, in Chrome there seems to be no problem.

This error happened in much larger project, but I managed to distill it to the following little example.

<html>
<head>
<script>
  window.onload = function() {
     var copy = document.getElementById("s");
     document.getElementById("newparent").appendChild(copy); //if I comment out this line, example works
  }
</script>
</head>

<body>
  <div id="newparent"> <!-- here will the object be appended -->
  </div>
  <div id="s">
    <object width="50%" height="50%" data="http://www.w3schools.com/tags/helloworld.swf">SWF Not shown</object>
  </div>
</body>
</html>

If I comment out the second line of my onload function, the flash shows properly (but it is not moved around). I am not able to google anything. Perhaps I am not able to describe my problem, I am pretty new to HTML. Thanks in advice.


Place your file in the BankAccountGUI directory(project's root directory). And then try to access the file like this:-

File file = new File("Text01.txt");

Note:- Your file should be at the same level as the src folder.

4

1 に答える 1

0

OK、皆さんのおかげで、何を探すべきかについてのアイデアがあり、この記事に出くわしました.

私が抱えている問題は、いくつかの「セキュリティ」の問題のようです。移動後にフラッシュがロードされない理由。私はこの汚い回避策を考案しました。単純にブラウザに強制的recalculateobjectタグを解析させます。そうですか?私が何をしているのかをよく理解していることを願っています。

<html>
<head>
<script>
  window.onload = function() {
     var copy = document.getElementById("s");
     document.getElementById("newparent").appendChild(copy);
     copy.innerHTML = copy.innerHTML; //dirty workaround
  }
</script>
</head>

<body>
  <div id="newparent"> <!-- here will the object be appended -->
  </div>
  <div id="s">
    <object width="50%" height="50%" data="http://www.w3schools.com/tags/helloworld.swf">SWF Not shown</object>
  </div>
</body>
</html>
于 2013-04-08T13:29:19.577 に答える