replacing whole HTMLinside body tag
html, javascript
Solution
`.getElementsByTagName` returns an array so you have to use `[0]` to get the first element:
<script type="text/javascript">
var content = 'some content';
document.getElementsByTagName('body')[0].innerHTML = content;
</script>
Here is an example: http://jsfiddle.net/MWjsc/
Problem
I want to replace the whole HTML inside body tag with some content and I use these codes inside both head and body sections, but in the fist code it doesn't show the content and in the second code it shows the content but doesn't clear ex-content. the first code: ``` <script> var content = 'some content'; if(navigator.appName=="Netscape") { document.getElementsByTagName('body').innerHTML = content; } </script> ``` the second code: ``` <script> var content = 'some content'; if(navigator.appName=="Netscape") { document.body.innerHTML = content; } </script> ``` also I use some php code in the document what should I do? thanks