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.
精彩评论