faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

31 of 45 people (69%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I override the document.write and window.open methods by my own methods

Apr 4th, 2008 20:50
ha mo, Russ Thomas, Herman van der Sluijs,


<title>overrides</title>
<script>
function myDocWrite()
{
  var args = myDocWrite.arguments;
  if(args.length)
    alert(args[0]);
}
function myWndOpen()
{
  var args = myWndOpen.arguments;
  if(args.length)
    alert(args[0]);
}
document.write = myDocWrite;
window.open = myWndOpen;
</script>
<body>
<script>
  document.write("Testing...");
  window.open("More Testing...");
</script>
</body>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com