Hi friends,
I want to include an html page inside an html page. Is it possible? Please give me the code. I dont want to do it in PHP, I know that in PHP, we can use include for this situation, how can I achieve the same purely in html without using the iframe and frame concept?
-
<iframe src="page.html"></iframe>
You will need to add some styling to this iframe. You can specify width, height, and if you want it to look like a part of the original page include fameborder="0".
There is no other way to do it in pure HTML. This is what they were built for, it's like saying I want to fry an egg without an egg.
-
If you're just trying to stick in your own HTML from another file, and you consider a Server Side Include to be "pure HTML" (because it kind of looks like an HTML comment and isn't using something "dirty" like PHP):
<!--#include virtual="/footer.html" -->
Sam152 : This isnt a pure HTML solution is it?Daniel LeCheminant : @Sam152: Shhh! ;-]Sam152 : Yeah +1. Its probably the better way of doing it. He also says that he doesn't want to use an iframe, so who knows which solution will work best.praveenjayapal : Hey, here i got a idea, i have included the whole content inside the javascript - document.write. then place the javascript file inside the html. It working -
If you mean client side then you will have to use JavaScript or frames.
Simple way to start, try jQuery$("#links").load("/Main_Page #jq-p-Getting-Started li");
More at jQuery Docs
If you want to use IFrames then start with Wikipedia on IFrames
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Example</title> </head> <body> The material below comes from the website http://example.com/ <iframe src="http://example.com/" height="200"> Alternative text for browsers that do not understand IFrames. </iframe> </body> </html>
praveenjayapal : Hey, here i got a idea, i have included the whole content inside the javascript - document.write. then place the javascript file inside the html. It working -
You can use an object element-
<object type="text/html" data="urltofile.html"></object>
Or, on your local server, Ajax can return a string of html (responseText) that you can use to document.write a new window, or edit out the head and body tags and add the rest to a div or other block element in the current page.
-
@PraveenJayapal :: How to include the HTML content in a JAVASCRIPT file?? And how to place it inside the HTML page?
0 comments:
Post a Comment