PDA

View Full Version : Loading of frames


sandipdev
05-18-2003, 07:28 PM
I am a Javascript newbie. I want to create three frames into my page on the fly . Say I have a page mypage.htm(which does not contain any frames). When a user visits it, three frames should be created in it. The three frames will have pages like page1.htm, page2.htm and page3.htm.

I have written a code but it does not work

Here it is:

<html>
<head>
<title>Untitled Document</title>
<script language="Javascript">
document.write("<frameset rows="3*,6*,1*" frameborder="NO" cols="*">" );
document.write("<frame src="page1.htm" name="head" frameborder="0" scrolling="no" noresize>");
document.write("<frame src="page2.htm" name="body" frameborder="0" scrolling="auto" noresize>");
documnet.write("<frame src="page3.htm" name="foot" frameborder="0" scrolling="no" noresize>");
</script>
</head>

<body>
This is mypage.htm
</body>
</html>

Can you please help me?

:rolleyes:

AgaBoogaBoo
05-18-2003, 08:07 PM
Why not just make the frame loaded with the page and not created with the page?

cheesebagpipe
05-18-2003, 09:02 PM
<html>
<head>
<title>Untitled Document</title>
</head>
<script language="Javascript">
document.write("<frameset rows="3*,6*,1*" frameborder="NO" cols="*">" );
document.write("<frame src="page1.htm" name="head" frameborder="0" scrolling="no" noresize>");
document.write("<frame src="page2.htm" name="body" frameborder="0" scrolling="auto" noresize>");
documnet.write("<frame src="page3.htm" name="foot" frameborder="0" scrolling="no" noresize>");
document.write("</frameset>");
</script>
</html>

A valid document can't have both <frameset> and <body> tags, unless the body tags are inside <noframe> tags. The above is pretty much the equivalent of simply hardcoding the HTML instead of generating it, so....??

http://www.htmlhelp.com/reference/html40/frames/noframes.html