Loading Seperate Page in a DIV

Hello,

I'm trying to load another "frame" in a div tag. Is there anyway to do this without using javascript?

For example, I have page1.htm:

<html>
<p>this is page 1</p>

<div>in this div I would like to display the contents of page2.htm</div>
</html>
---------------------------
page2.htm:
<p>hello</p>


Thank you in advance for helping!
LVL 8
YoungBonziAsked:
Who is Participating?
 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
YoungBonzi,

You want to use an iframe tag.  Sample code is below:

<html>
<p>this is page 1</p>

<div><iframe src="page2.htm" name="frame" width="400" height="400">
</div>
</html>

This page (http://www.htmlhelp.com/reference/html40/special/iframe.html) has some information on the tag.  A google search using "iframe" will also give you lots of other good sites.  The tag is well supported by the current new browsers.  Width and height attributes can be specified in pixels, like I did, or using a percentage.

b0lsc0tt
0
 
YoungBonziAuthor Commented:
Thanks b0lsc0tt, but the page I'm editing only allows div tags. I wish I were allowed to use iframs =/
0
 
b0lsc0ttIT ManagerCommented:
Wow!  Sorry can't help with that.  As far as I know there is no way you could do it even with a client side script.  The script would have to manually fill the div with the contents of the second page.  There is no src attribute in the div tag that would let you load a seperate page.  Another expert may prove me wrong or think of something I can't think of now so I am interested to see what comments you get.  If you can't use iframes then is javascript even an option?

You could easily do this on the server side if that is an option.  Server side script languages, like ASP, PHP, or Perl, will open a file and then you can stream it contents in to the div tag.  The HTML code would not show any sign that 2 pages were used.
0
 
YoungBonziAuthor Commented:
No, I'm trying to mess around in MySpace...they won't let me use Javascript or anything like that...I'm hoping someone knows a way to get around the limitations.
0
 
b0lsc0ttIT ManagerCommented:
Thanks!  I wish I could have helped you get it going but I'm glad that you found my information helpful enough to accept.  Good luck with the rest of the project and working around the limitations of myspace.

bol
0
All Courses

From novice to tech pro — start learning today.