...

View Full Version : Overriding document.write, and then bringing it back



peebrain
08-09-2004, 12:29 AM
My problem is that I want to override document.write, so external scripts use my personal function to save what they want to write, then when control is given back to me, I want to actually call the real document.write function to write it all at once.

So this is what I coded:



<SCRIPT LANGUAGE="JavaScript1.1"><!--
var pp_save_saveDW = "";
var pp_save_trueDW = document.write;
function pp_save_overDW()
{
var args = pp_save_overDW.arguments;
if (args.length)
pp_save_saveDW += args[0];
}
document.write = pp_save_overDW;
--></SCRIPT>

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.1"
SRC="http://external.script.com/here.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1"><!--
pp_save_trueDW(pp_save_saveDW);
--></SCRIPT>


This does not seem to be working for me. I save the original document.write, then I override it. Then I try to call the original one, but it doesn't work. Is there a way to reset document.write to the correct, original function?

~Sean

jamescover
08-09-2004, 12:43 AM
I want to override document.write, so external scripts use my personal function to save what they want to write, then when control is given back to me, I want to actually call the real document.write function to write it all at once. :confused:

peebrain
08-09-2004, 05:40 AM
Nevermind... actually that code worked, the error was somewhere else. I got it to work.

~Sean



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum