Page 1 of 1
overwrite existing html
Posted: Fri Jun 25, 2004 10:27 pm
by Illusionist
I have a link to a pop-up, that is the same page but is going to load different information. Well, what i want is to clear the existing html on the pop aup and then do whatever with it. I've tried several different ways:
Code: Select all
<script>
document.innerhtml="";
</script>
Code: Select all
<script>
window.document.innerhtml="";
</script>
Code: Select all
<body onload="document.innerhtml=''">
Code: Select all
<body onload="window.document.innerhtml=''">
But none seem to work! Anyone have any suggestions??
Posted: Fri Jun 25, 2004 11:11 pm
by Illusionist
hmm... But i just tried:
Code: Select all
<a href="javascript:document.innerhtml=''">here</a>
and loaded the page and clicked the link and it cleared it, but why wont it work if i do the same in the body onload ??
Posted: Sat Jun 26, 2004 10:03 pm
by Illusionist
anyone? anything?
Posted: Sat Jun 26, 2004 10:21 pm
by Weirdan
what if:
Code: Select all
<html>
<head>
<script type='text/javascript'>
function cleardoc() {
document.innerHTML='';
}
</script>
</head>
<body onload='window.setTimeout(cleardoc, 300); return true;' >
</body>
</html>
Posted: Sat Jun 26, 2004 10:34 pm
by Illusionist
Nope that doesn't work either. I'd tried that before, but it didn't work.... And it still doesn't
Posted: Sat Jun 26, 2004 11:22 pm
by Weirdan
Code: Select all
<head>
<script type='text/javascript'>
function clearBody() {
document.body.innerHTML = '';
}
</script>
</head>
<body onload='clearBody();';>
Posted: Sun Jun 27, 2004 11:12 pm
by Illusionist
That doesn't work either! What in the world is wrong with this?!
Posted: Sun Jun 27, 2004 11:52 pm
by feyd
ever try:
Code: Select all
<body onload="document.write('')">
? IE6 SP2 won't let it write out, by default.. but everything else should..
Posted: Mon Jun 28, 2004 12:54 am
by Weirdan
Illusionist wrote:That doesn't work either! What in the world is wrong with this?!
That does work in Opera 7.2x, Firefox 0.8 and ie6 sp1
Posted: Mon Jun 28, 2004 11:09 am
by phice
Wow, that's odd. It works fine for me in IE 6.
Code: Select all
<head>
<script type='text/javascript'>
function clearBody() {
document.body.innerHTML = '';
}
</script>
</head>
<!--<body onload='clearBody();'>-->
ahahhaahahahahah
a
hah
ah
ah
a
ha
hah
ah
ah
a
h
<a href="#" onClick="clearBody();">clear!</a>
You can take the comment out of the body for it to clear on load.
Posted: Mon Jun 28, 2004 12:24 pm
by Illusionist
feyd wrote:ever try:
Code: Select all
<body onload="document.write('')">
? IE6 SP2 won't let it write out, by default.. but everything else should..
That does work, but then i can't output anything else... And all the other suggestions DO NOT work for my with what I'm doing in any of the browsers you said. What is happening is im loading the same page in a pop-up, but before i check the url and output what i need, i include the header and stuff. But what i'm trying to do is clear what the include included so i have a blank page to output what i need. And it would really suck to have to move the headers around and put them in like 20 different places, so If i can't get this to work, i may have to do that...