开发者

How can I control the layout of an embedded <OBJECT>?

开发者 https://www.devze.com 2023-01-23 22:44 出处:网络
Page1.html has <html><head> </head> <body> [<span class=\"foo\">span unchanged</span>]

Page1.html has

<html><head>
</head>
<body>
[<span class="foo">span unchanged</span>]
<script type="text/javascript">
    var a = document.getElementsByClassName('foo').item(0);
    var synth = '<object data="http://localhost/~bruceaxtens/Page2.html">Page2.html not found</object>';
    a.innerHTML = synth;
</script>
</body开发者_开发问答>
</html>

So there are square brackets which should enclose the text which will be handed back by Page2.html

Page2.html contains

<html>
<head></head>
<body>
<script type="text/javascript">
document.write("Hello World");
</script>
</body>
</html>

What I get however is the "Hello World" at the top of the page and the brackets a couple of inches further down.

Is there any way of keeping the two together?


I answer myself thus:

Instead of returning HTML and have issues with OBJECT handling in different browsers, hand back Javascript and execute it in the context of the client's DOM.

0

精彩评论

暂无评论...
验证码 换一张
取 消