views:

29

answers:

1

Hello

I want the document.write code to load a page(as iframe)

example - i need document.write function to get http://google.com

I dont want html function but as document.write

+1  A: 

I'm not sure that you know what the document.write method does...

The document.write method is used to write HTML code into the current document. If it's done at load time, the code becomes part of the document currently loading. If it's done after the page has loaded, it will replace the current page.

You can use the method to write code to a window or a frame, but you can't use it to change the location of the window. Even if you get the HTML code from google.com and write it to a window, the location will not be google.com so the code will most likely not work properly.

If you want to change the location of a window, you just use the location.href property:

window.location.href = 'http://google.com';
Guffa
Thanks dude..... Yeah i din't know what it really does... but i saw once in a famouse blog they called a page in document.write as iframe
Athul